davek1312 / testing
Testing helpers
v0.1.1
2017-05-07 14:50 UTC
Requires
- illuminate/support: ^5.4
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2025-01-17 19:33:49 UTC
README
Testing helpers.
Installation
The package is available on Packagist, you can install it using Composer.
composer require davek1312/testing
Usage
Your test class should implement our TestClass
class:
<?php
namespace Davek1312\Testing;
class YourTestCase extends \Davek1312\Testing\TestCase {
}
Database
Resetting The Database After Each Test It is often useful to reset your database after each test so that data from a previous test does not interfere with subsequent tests.
Using Migrations
One option is to rollback the database after each test and migrate it before the next test:
<?php
namespace Davek1312\Testing;
class YourTestCase extends \Davek1312\Testing\TestCase {
use \Davek1312\Database\Testing\MakesDatabaseMigrations;
}
Using Transactions
Another option is to wrap every test case in a database transaction:
<?php
namespace Davek1312\Testing;
class YourTestCase extends \Davek1312\Testing\TestCase {
use \Davek1312\Database\Testing\MakesDatabaseTransactions;
}