22
33namespace Tests \Commands ;
44
5- use Illuminate \Support \Facades \Schema ;
65use Tests \TestCase ;
76
87final class RollbackTest extends TestCase
98{
109 public function testRollbackCommand ()
1110 {
12- $ this ->assertFalse (
13- Schema::hasTable ($ this ->table )
14- );
11+ $ this ->assertDatabaseDoesntTable ($ this ->table );
1512
1613 $ this ->artisan ('migrate:actions:install ' )->run ();
1714
18- $ this ->assertTrue (
19- Schema::hasTable ($ this ->table )
20- );
21-
15+ $ this ->assertDatabaseHasTable ($ this ->table );
2216 $ this ->assertDatabaseCount ($ this ->table , 0 );
2317
2418 $ this ->artisan ('make:migration:action ' , ['name ' => 'RollbackOne ' ])->run ();
@@ -27,13 +21,9 @@ public function testRollbackCommand()
2721
2822 $ this ->assertDatabaseCount ($ this ->table , 2 );
2923
30- $ this ->assertTrue (
31- $ this ->table ()->whereRaw ('migration like \'%rollback_one \'' )->exists ()
32- );
33-
34- $ this ->assertTrue (
35- $ this ->table ()->whereRaw ('migration like \'%rollback_two \'' )->exists ()
36- );
24+ $ this ->assertDatabaseHasLike ($ this ->table , 'migration ' , 'rollback_one ' );
25+ $ this ->assertDatabaseHasLike ($ this ->table , 'migration ' , 'rollback_two ' );
26+ $ this ->assertDatabaseDoesntLike ($ this ->table , 'migration ' , 'rollback_tree ' );
3727
3828 $ this ->artisan ('migrate:actions:rollback ' )->run ();
3929
@@ -48,8 +38,8 @@ public function testRollbackCommand()
4838
4939 $ this ->assertDatabaseCount ($ this ->table , 3 );
5040
51- $ this ->assertTrue (
52- $ this ->table ()-> whereRaw ( 'migration like \' %rollback_tree \'' )-> exists ()
53- );
41+ $ this ->assertDatabaseHasLike ( $ this -> table , ' migration ' , ' rollback_one ' );
42+ $ this ->assertDatabaseHasLike ( $ this -> table , 'migration ' , ' rollback_two ' );
43+ $ this -> assertDatabaseHasLike ( $ this -> table , ' migration ' , ' rollback_tree ' );
5444 }
5545}
0 commit comments