1111use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedPublisher ;
1212use GeneaLabs \LaravelModelCaching \Tests \Fixtures \UncachedStore ;
1313use GeneaLabs \LaravelModelCaching \Tests \Fixtures \Http \Resources \Author as AuthorResource ;
14- use GeneaLabs \LaravelModelCaching \Tests \TestCase ;
14+ use GeneaLabs \LaravelModelCaching \Tests \UnitTestCase ;
1515use Illuminate \Foundation \Testing \RefreshDatabase ;
1616
1717/**
1818* @SuppressWarnings(PHPMD.TooManyPublicMethods)
1919* @SuppressWarnings(PHPMD.TooManyMethods)
2020 */
21- class CachedBuilderTest extends TestCase
21+ class CachedBuilderTest extends UnitTestCase
2222{
2323 use RefreshDatabase;
2424
@@ -83,10 +83,10 @@ public function testCreatingModelClearsCache()
8383 'genealabslaravelmodelcachingtestsfixturesauthor ' ,
8484 'genealabslaravelmodelcachingtestsfixturesbook '
8585 ])
86- ->get (
86+ ->get (sha1 (
8787 'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
8888 '7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
89- );
89+ )) ;
9090
9191 $ this ->assertNull ($ results );
9292 }
@@ -101,10 +101,10 @@ public function testUpdatingModelClearsCache()
101101 'genealabslaravelmodelcachingtestsfixturesauthor ' ,
102102 'genealabslaravelmodelcachingtestsfixturesbook '
103103 ])
104- ->get (
104+ ->get (sha1 (
105105 'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
106106 '7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
107- );
107+ )) ;
108108
109109 $ this ->assertNull ($ results );
110110 }
@@ -118,10 +118,10 @@ public function testDeletingModelClearsCache()
118118 'genealabslaravelmodelcachingtestsfixturesauthor ' ,
119119 'genealabslaravelmodelcachingtestsfixturesbook '
120120 ])
121- ->get (
121+ ->get (sha1 (
122122 'genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_ ' .
123123 '7_8_9_10-genealabslaravelmodelcachingtestsfixturesbooks '
124- );
124+ )) ;
125125
126126 $ this ->assertNull ($ results );
127127 }
@@ -424,24 +424,22 @@ public function testSumModelResultsCreatesCache()
424424
425425 public function testValueModelResultsCreatesCache ()
426426 {
427- $ authors = (new Author )->with ('books ' , 'profile ' )
427+ $ authorName = (new Author )->with ('books ' , 'profile ' )
428428 ->value ('name ' );
429- $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesauthor_name -books-profile-first ' );
429+ $ key = sha1 ('genealabslaravelmodelcachingtestsfixturesauthor -books-profile-value_name ' );
430430 $ tags = [
431431 'genealabslaravelmodelcachingtestsfixturesauthor ' ,
432432 'genealabslaravelmodelcachingtestsfixturesbook ' ,
433433 'genealabslaravelmodelcachingtestsfixturesprofile ' ,
434434 ];
435435
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 ' )
441439 ->value ('name ' );
442440
443- $ this ->assertEquals ($ authors , $ cachedResults );
444- $ this ->assertEquals ($ liveResults , $ cachedResults );
441+ $ this ->assertEquals ($ authorName , $ cachedResult );
442+ $ this ->assertEquals ($ authorName , $ liveResult );
445443 }
446444
447445 public function testNestedRelationshipEagerLoading ()
0 commit comments