https://github.com/brandonbest/php-unittest-sqlite
Limit the number of migrations/seeders run during phpunit tests with Sqlite. Designed for repos with a large number of migrations/seeders to quickly refresh the database.
https://github.com/brandonbest/php-unittest-sqlite
laravel lumen phpunit-tests sqlite
Last synced: 2 months ago
JSON representation
Limit the number of migrations/seeders run during phpunit tests with Sqlite. Designed for repos with a large number of migrations/seeders to quickly refresh the database.
- Host: GitHub
- URL: https://github.com/brandonbest/php-unittest-sqlite
- Owner: brandonbest
- License: mit
- Created: 2020-08-07T04:48:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-22T21:49:07.000Z (over 4 years ago)
- Last Synced: 2025-11-07T19:19:15.414Z (5 months ago)
- Topics: laravel, lumen, phpunit-tests, sqlite
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP UnitTest Sqlite
This package optimizes unit testing speed, especially for packages with a large number of migrations and/or seeders.
The package works by managing two copies of a sqlite database, `base` and `copy`. Migrations and seeders are run on `copy` if `base` does not exist.
`Copy` is cloned into `base`. Every unit test with `RefreshDatabase` trait will delete `copy` and clone `base` into `copy`.
`Base` is deleted at the end of the unit test (you can keep `Base` around with a simple configuration update).
---
# Setup
## Install
```
composer require --dev brandonbest/php-unittest-sqlite
```
## PHP Unit
Add the following listener to phpunit.xml.
```
```
## Commands
```php artisan sqlite:delete```
Deletes the `base` file.
## Future Plans
- Automatically detect new migrations and update the base sqlite