11
11
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedPublisher ;
12
12
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedStore ;
13
13
use GeneaLabs \LaravelModelCaching \Tests \Fixtures \Http \Resources \Author as AuthorResource ;
14
- use GeneaLabs \LaravelModelCaching \Tests \TestCase ;
14
+ use GeneaLabs \LaravelModelCaching \Tests \UnitTestCase ;
15
15
use Illuminate \Foundation \Testing \RefreshDatabase ;
16
16
17
17
/**
18
18
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
19
19
* @SuppressWarnings(PHPMD.TooManyMethods)
20
20
*/
21
- class CachedBuilderTest extends TestCase
21
+ class CachedBuilderTest extends UnitTestCase
22
22
{
23
23
use RefreshDatabase;
24
24
@@ -83,10 +83,10 @@ public function testCreatingModelClearsCache()
83
83
'genealabslaravelmodelcachingtestsfixturesauthor ' ,
84
84
'genealabslaravelmodelcachingtestsfixturesbook '
85
85
])
86
- ->get (
86
+ ->get (sha1 (
87
87
'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
88
88
'7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
89
- );
89
+ )) ;
90
90
91
91
$ this ->assertNull ($ results );
92
92
}
@@ -101,10 +101,10 @@ public function testUpdatingModelClearsCache()
101
101
'genealabslaravelmodelcachingtestsfixturesauthor ' ,
102
102
'genealabslaravelmodelcachingtestsfixturesbook '
103
103
])
104
- ->get (
104
+ ->get (sha1 (
105
105
'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
106
106
'7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
107
- );
107
+ )) ;
108
108
109
109
$ this ->assertNull ($ results );
110
110
}
@@ -118,10 +118,10 @@ public function testDeletingModelClearsCache()
118
118
'genealabslaravelmodelcachingtestsfixturesauthor ' ,
119
119
'genealabslaravelmodelcachingtestsfixturesbook '
120
120
])
121
- ->get (
121
+ ->get (sha1 (
122
122
'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
123
123
'7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
124
- );
124
+ )) ;
125
125
126
126
$ this ->assertNull ($ results );
127
127
}
@@ -424,24 +424,22 @@ public function testSumModelResultsCreatesCache()
424
424
425
425
public function testValueModelResultsCreatesCache ()
426
426
{
427
- $ authors = (new Author )->with ('books ' , 'profile ' )
427
+ $ authorName = (new Author )->with ('books ' , 'profile ' )
428
428
->value ('name ' );
429
- $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesauthor_name -books-profile-first ' );
429
+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesauthor -books-profile-value_name ' );
430
430
$ tags = [
431
431
'genealabslaravelmodelcachingtestsfixturesauthor ' ,
432
432
'genealabslaravelmodelcachingtestsfixturesbook ' ,
433
433
'genealabslaravelmodelcachingtestsfixturesprofile ' ,
434
434
];
435
435
436
- $ cachedResults = cache ()->tags ($ tags )
437
- ->get ($ key )
438
- ->name ;
439
-
440
- $ liveResults = (new UncachedAuthor )->with ('books ' , 'profile ' )
436
+ $ cachedResult = cache ()->tags ($ tags )
437
+ ->get ($ key );
438
+ $ liveResult = (new UncachedAuthor )->with ('books ' , 'profile ' )
441
439
->value ('name ' );
442
440
443
- $ this ->assertEquals ($ authors , $ cachedResults );
444
- $ this ->assertEquals ($ liveResults , $ cachedResults );
441
+ $ this ->assertEquals ($ authorName , $ cachedResult );
442
+ $ this ->assertEquals ($ authorName , $ liveResult );
445
443
}
446
444
447
445
public function testNestedRelationshipEagerLoading ()
0 commit comments