https://github.com/ezitisitis/laravel-refresh-database-once
This package provides Trait to refresh database once before running tests
https://github.com/ezitisitis/laravel-refresh-database-once
Last synced: 6 months ago
JSON representation
This package provides Trait to refresh database once before running tests
- Host: GitHub
- URL: https://github.com/ezitisitis/laravel-refresh-database-once
- Owner: ezitisitis
- Archived: true
- Created: 2024-02-04T16:00:56.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T19:54:00.000Z (over 1 year ago)
- Last Synced: 2025-07-01T09:16:33.529Z (about 1 year ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel DB refresh
**⚠️ Notice: This project is no longer maintained. As a replacement please use [RefreshDatabase](https://laravel.com/docs/12.x/database-testing#resetting-the-database-after-each-test).**
This package contains Trait to refresh and seed database before running test scope.
## Why do you need that
When you work in local environment. It sometimes appears that you want to run tests agains clean database (for example you have record count somewhere in tests).
Running each test on clear database is bad idea in general, because:
1. You check only that your code works only when there is no records;
2. **It is insanely time consuming**;
## Installing
1. `composer require --dev ezitisitis/laravel-refresh-database-once`;
2. Add `MigrateFreshSeedOnce` use to `TestCase` class;
3. Congratulations, you are done.
Example:
```php