Skip to content

Commit ac66830

Browse files
committed
wip
1 parent 7c725b3 commit ac66830

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

database-testing.md

+6-19
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,18 @@ Laravel provides a variety of helpful tools and assertions to make it easier to
2828
<a name="resetting-the-database-after-each-test"></a>
2929
### Resetting The Database After Each Test
3030

31-
Before proceeding much further, let's discuss how to reset your database after each of your tests so that data from a previous test does not interfere with subsequent tests. Laravel's included `Illuminate\Foundation\Testing\RefreshDatabase` trait will take care of this for you. Simply use the trait on your test class:
31+
Before proceeding much further, let's discuss how to reset your database after each of your tests so that data from a previous test does not interfere with subsequent tests. Laravel's included `Illuminate\Foundation\Testing\LazilyRefreshDatabase` trait will take care of this for you. This trait is already included on your application's base `TestCase` class so that you may always assume you have a fresh copy of your database during each of your application's "feature" tests:
3232

3333
<?php
3434

35-
namespace Tests\Feature;
35+
namespace Tests;
3636

37-
use Illuminate\Foundation\Testing\RefreshDatabase;
38-
use Illuminate\Foundation\Testing\WithoutMiddleware;
39-
use Tests\TestCase;
37+
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
38+
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
4039

41-
class ExampleTest extends TestCase
40+
abstract class TestCase extends BaseTestCase
4241
{
43-
use RefreshDatabase;
44-
45-
/**
46-
* A basic functional test example.
47-
*
48-
* @return void
49-
*/
50-
public function test_basic_example()
51-
{
52-
$response = $this->get('/');
53-
54-
// ...
55-
}
42+
use CreatesApplication, LazilyRefreshDatabase;
5643
}
5744

5845
<a name="defining-model-factories"></a>

0 commit comments

Comments
 (0)