File tree 2 files changed +9
-3
lines changed
tests/Unit/Console/Commands
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -12,5 +12,6 @@ public function handle()
12
12
$ option = $ this ->option ('model ' );
13
13
$ model = new $ option ;
14
14
$ model ->flushCache ();
15
+ $ this ->info ("Cache for model ' {$ option }' flushed. " );
15
16
}
16
17
}
Original file line number Diff line number Diff line change 1
- <?php namespace GeneaLabs \LaravelModelCaching \Tests \Unit ;
1
+ <?php namespace GeneaLabs \LaravelModelCaching \Tests \Unit \ Console \ Commands ;
2
2
3
3
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \Author ;
4
4
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \Book ;
@@ -48,13 +48,14 @@ public function testGivenModelIsFlushed()
48
48
$ cachedResults = cache ()
49
49
->tags ($ tags )
50
50
->get ($ key );
51
- $ this ->artisan ('modelCache:flush ' , ['--model ' => Author::class]);
51
+ $ result = $ this ->artisan ('modelCache:flush ' , ['--model ' => Author::class]);
52
52
$ flushedResults = cache ()
53
53
->tags ($ tags )
54
54
->get ($ key );
55
55
56
56
$ this ->assertEquals ($ authors , $ cachedResults );
57
57
$ this ->assertEmpty ($ flushedResults );
58
+ $ this ->assertEquals ($ result , 0 );
58
59
}
59
60
60
61
public function testGivenModelWithRelationshipIsFlushed ()
@@ -69,12 +70,16 @@ public function testGivenModelWithRelationshipIsFlushed()
69
70
$ cachedResults = cache ()
70
71
->tags ($ tags )
71
72
->get ($ key );
72
- $ this ->artisan ('modelCache:flush ' , ['--model ' => Author::class]);
73
+ $ result = $ this ->artisan (
74
+ 'modelCache:flush ' ,
75
+ ['--model ' => Author::class]
76
+ );
73
77
$ flushedResults = cache ()
74
78
->tags ($ tags )
75
79
->get ($ key );
76
80
77
81
$ this ->assertEquals ($ authors , $ cachedResults );
78
82
$ this ->assertEmpty ($ flushedResults );
83
+ $ this ->assertEquals ($ result , 0 );
79
84
}
80
85
}
You can’t perform that action at this time.
0 commit comments