| 1 | <?php |
||
| 3 | class TestCase extends Illuminate\Foundation\Testing\TestCase { |
||
|
|
|||
| 4 | |||
| 5 | public $dbSeeded = false; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Creates the application. |
||
| 9 | * |
||
| 10 | * @return \Symfony\Component\HttpKernel\HttpKernelInterface |
||
| 11 | */ |
||
| 12 | 9 | public function createApplication() { |
|
| 19 | |||
| 20 | 9 | public function seedDatabase() { |
|
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Start database transaction to speed up the tests related to database |
||
| 29 | */ |
||
| 30 | 9 | public function setUp() { |
|
| 31 | 9 | parent::setUp(); |
|
| 32 | |||
| 33 | 9 | if (! $this->dbSeeded) { |
|
| 34 | 9 | $this->seedDatabase(); |
|
| 35 | 9 | } |
|
| 36 | |||
| 37 | 9 | DB::beginTransaction(); |
|
| 38 | 9 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * After test roll back all done stuff |
||
| 42 | */ |
||
| 43 | 9 | public function tearDown() { |
|
| 44 | 9 | parent::tearDown(); |
|
| 45 | |||
| 46 | 9 | DB::rollBack(); |
|
| 47 | 9 | } |
|
| 48 | } |
||
| 49 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.