diff --git a/src/CacheKey.php b/src/CacheKey.php index c4b985f2..d804cd55 100644 --- a/src/CacheKey.php +++ b/src/CacheKey.php @@ -4,6 +4,7 @@ use GeneaLabs\LaravelModelCaching\Traits\CachePrefixing; use Illuminate\Support\Arr; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\URL; use Illuminate\Support\Str; use Ramsey\Uuid\Uuid; @@ -45,6 +46,7 @@ public function make( $key .= $this->getOffsetClause(); $key .= $this->getLimitClause(); $key .= $this->getBindingsSlug(); + $key .= $this->getPathSlug(); $key .= $keyDifferentiator; $key .= $this->macroKey; // dump($key); @@ -362,4 +364,9 @@ protected function getBindingsSlug() : string return Arr::query($this->model->query()->getBindings()); } + + protected function getPathSlug() : string + { + return ':' . strtolower(URL::to('/')); + } } diff --git a/tests/Feature/PaginationTest.php b/tests/Feature/PaginationTest.php index ca0215ec..0e353370 100644 --- a/tests/Feature/PaginationTest.php +++ b/tests/Feature/PaginationTest.php @@ -1,5 +1,9 @@ see($page2ActiveLink); } + + public function testPaginationUrlIsCorrect() { + $this->baseUrl = 'https://test.local'; + + $this->visit("pagination-test2?custom-page=2") + ->see('https://test.local/pagination-test2?custom-page=1'); + + $this->baseUrl = 'https://changed.local'; + + $this->visit("pagination-test2?custom-page=2") + ->see('https://changed.local/pagination-test2?custom-page=1'); + + } } diff --git a/tests/Integration/CachedBuilder/BelongsToManyTest.php b/tests/Integration/CachedBuilder/BelongsToManyTest.php index 744d7566..71dd26ee 100644 --- a/tests/Integration/CachedBuilder/BelongsToManyTest.php +++ b/tests/Integration/CachedBuilder/BelongsToManyTest.php @@ -21,7 +21,7 @@ public function testLazyLoadingRelationship(): void ->books ->first() ->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", ]; @@ -52,7 +52,7 @@ public function testInvalidatingCacheWhenAttaching() ->books ->first() ->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore-testing:{$this->testingSqlitePath}testing.sqlite:books-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore-testing:{$this->testingSqlitePath}testing.sqlite:books-first:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", ]; @@ -85,7 +85,7 @@ public function testInvalidatingCacheWhenDetaching() ->books ->first() ->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", ]; @@ -116,7 +116,7 @@ public function testInvalidatingCacheWhenUpdating() ->books ->first() ->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", ]; @@ -146,7 +146,7 @@ public function testUncachedRelatedModelDoesntCache() ->books ->first() ->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesuncachedstore", ]; diff --git a/tests/Integration/CachedBuilder/BooleanTest.php b/tests/Integration/CachedBuilder/BooleanTest.php index f03188e7..364cf11c 100644 --- a/tests/Integration/CachedBuilder/BooleanTest.php +++ b/tests/Integration/CachedBuilder/BooleanTest.php @@ -8,7 +8,7 @@ class BooleanTest extends IntegrationTestCase { public function testBooleanWhereCreatesCorrectCacheKey() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-is_famous_=_1-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-is_famous_=_1-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/DateTimeTest.php b/tests/Integration/CachedBuilder/DateTimeTest.php index 4687b4b8..4d27e895 100644 --- a/tests/Integration/CachedBuilder/DateTimeTest.php +++ b/tests/Integration/CachedBuilder/DateTimeTest.php @@ -11,7 +11,7 @@ class DateTimeTest extends IntegrationTestCase public function testWhereClauseWorksWithCarbonDate() { $dateTime = now()->subYears(10); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publish_at_>_{$dateTime}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publish_at_>_{$dateTime}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -38,7 +38,7 @@ public function testWhereClauseWorksWithDateTimeObject() $dateTime = (new DateTime('@' . time())) ->sub(new DateInterval("P10Y")); $dateTimeString = $dateTime->format("Y-m-d-H-i-s"); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publish_at_>_{$dateTimeString}"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publish_at_>_{$dateTimeString}:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/DeleteTest.php b/tests/Integration/CachedBuilder/DeleteTest.php index b445ed4e..b1b3dc02 100644 --- a/tests/Integration/CachedBuilder/DeleteTest.php +++ b/tests/Integration/CachedBuilder/DeleteTest.php @@ -10,7 +10,7 @@ public function testDecrementingInvalidatesCache() $book = (new Book) ->orderBy("id", "DESC") ->first(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_orderBy_id_desc-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_orderBy_id_desc:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/FindOrFailTest.php b/tests/Integration/CachedBuilder/FindOrFailTest.php index 585b18a8..91d910cc 100644 --- a/tests/Integration/CachedBuilder/FindOrFailTest.php +++ b/tests/Integration/CachedBuilder/FindOrFailTest.php @@ -11,7 +11,7 @@ public function testFindOrFailCachesModels() $author = (new Author) ->findOrFail(1); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-find_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-find_1"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/FindTest.php b/tests/Integration/CachedBuilder/FindTest.php index 7673c5c3..12bec32d 100644 --- a/tests/Integration/CachedBuilder/FindTest.php +++ b/tests/Integration/CachedBuilder/FindTest.php @@ -26,7 +26,7 @@ public function testFindMultipleModelResultsCreatesCache() { $authors = (new Author) ->find([1, 2, 3]); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-find_list_1_2_3"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-find_list_1_2_3"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -66,7 +66,7 @@ public function testFindWithSingleElementArrayDoesntConflictWithNormalFind() ->find(1); $author2 = (new Author) ->find([1]); - + $this->assertNotEquals($author1, $author2); $this->assertIsIterable($author2); $this->assertEquals(Author::class, get_class($author1)); diff --git a/tests/Integration/CachedBuilder/ForceDeleteTest.php b/tests/Integration/CachedBuilder/ForceDeleteTest.php index 97042b32..4ac88215 100644 --- a/tests/Integration/CachedBuilder/ForceDeleteTest.php +++ b/tests/Integration/CachedBuilder/ForceDeleteTest.php @@ -17,7 +17,7 @@ public function testForceDeleteClearsCache() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]) ->get(sha1( - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_=_1-authors.deleted_at_null" + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_=_1-authors.deleted_at_null:http://localhost" ))["value"]; (new Author) @@ -29,7 +29,7 @@ public function testForceDeleteClearsCache() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]) ->get(sha1( - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_=_1" + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_=_1:http://localhost" ))["value"] ?? null; diff --git a/tests/Integration/CachedBuilder/GetTest.php b/tests/Integration/CachedBuilder/GetTest.php index 0cff5b85..c9facc1c 100644 --- a/tests/Integration/CachedBuilder/GetTest.php +++ b/tests/Integration/CachedBuilder/GetTest.php @@ -11,7 +11,7 @@ public function testGetModelResultsCreatesCache() $authors = (new Author) ->with('books', 'profile') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -49,7 +49,7 @@ public function testAccessingGetResultsViaArrayIndexDoesNotError() public function testGetWithFieldArrayCachesResults() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id_name-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id_name-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -69,7 +69,7 @@ public function testGetWithFieldArrayCachesResults() public function testGetWithFieldStringCachesResults() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/HasManyTest.php b/tests/Integration/CachedBuilder/HasManyTest.php index 2fb6afb8..18b60bb5 100644 --- a/tests/Integration/CachedBuilder/HasManyTest.php +++ b/tests/Integration/CachedBuilder/HasManyTest.php @@ -8,7 +8,7 @@ class HasManyTest extends IntegrationTestCase { public function testEagerloadedHasMany() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_inraw_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_inraw_1:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -34,7 +34,7 @@ public function testEagerloadedHasMany() public function testLazyloadedHasMany() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/HasManyThroughTest.php b/tests/Integration/CachedBuilder/HasManyThroughTest.php index 05dd7b1c..e165d351 100644 --- a/tests/Integration/CachedBuilder/HasManyThroughTest.php +++ b/tests/Integration/CachedBuilder/HasManyThroughTest.php @@ -8,7 +8,7 @@ class HasManyThroughTest extends IntegrationTestCase { public function testEagerloadedHasManyThrough() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:printers-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:printers:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesprinter", @@ -37,7 +37,7 @@ public function testEagerloadedHasManyThrough() public function testLazyloadedHasManyThrough() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-authors.id_=_1-testing:{$this->testingSqlitePath}testing.sqlite:printers-limit_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-authors.id_=_1:http://localhost-testing:{$this->testingSqlitePath}testing.sqlite:printers-limit_1"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesprinter", diff --git a/tests/Integration/CachedBuilder/HasOneThroughTest.php b/tests/Integration/CachedBuilder/HasOneThroughTest.php index fd23d5a3..03bdd659 100644 --- a/tests/Integration/CachedBuilder/HasOneThroughTest.php +++ b/tests/Integration/CachedBuilder/HasOneThroughTest.php @@ -10,7 +10,7 @@ class HasOneThroughTest extends IntegrationTestCase { public function testEagerloadedHasOneThrough() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:suppliers:genealabslaravelmodelcachingtestsfixturessupplier-testing:{$this->testingSqlitePath}testing.sqlite:history-limit_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:suppliers:genealabslaravelmodelcachingtestsfixturessupplier-testing:{$this->testingSqlitePath}testing.sqlite:history-limit_1:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturessupplier", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixtureshistory", @@ -39,7 +39,7 @@ public function testEagerloadedHasOneThrough() public function testLazyloadedHasOneThrough() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:suppliers:genealabslaravelmodelcachingtestsfixturessupplier-testing:{$this->testingSqlitePath}testing.sqlite:history-limit_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:suppliers:genealabslaravelmodelcachingtestsfixturessupplier-testing:{$this->testingSqlitePath}testing.sqlite:history-limit_1:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturessupplier", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixtureshistory", diff --git a/tests/Integration/CachedBuilder/LazyLoadTest.php b/tests/Integration/CachedBuilder/LazyLoadTest.php index 2d92ed18..85cc8e62 100644 --- a/tests/Integration/CachedBuilder/LazyLoadTest.php +++ b/tests/Integration/CachedBuilder/LazyLoadTest.php @@ -12,7 +12,7 @@ class LazyLoadTest extends IntegrationTestCase { public function testBelongsToRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.id_=_1-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.id_=_1-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -42,7 +42,7 @@ public function testBelongsToRelationship() public function testHasManyRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -73,7 +73,7 @@ public function testHasOneRelationship() $authorId = (new UncachedProfile) ->first() ->author_id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:profiles:genealabslaravelmodelcachingtestsfixturesprofile-profiles.author_id_=_{$authorId}-profiles.author_id_notnull-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:profiles:genealabslaravelmodelcachingtestsfixturesprofile-profiles.author_id_=_{$authorId}-profiles.author_id_notnull:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesprofile", ]; diff --git a/tests/Integration/CachedBuilder/LimitTest.php b/tests/Integration/CachedBuilder/LimitTest.php index 88b16e38..a07bc651 100644 --- a/tests/Integration/CachedBuilder/LimitTest.php +++ b/tests/Integration/CachedBuilder/LimitTest.php @@ -11,7 +11,7 @@ public function testGetModelResultsCreatesCache() $authors = (new Author) ->limit(5) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-limit_5"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-limit_5:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/MorphOneTest.php b/tests/Integration/CachedBuilder/MorphOneTest.php index ce1525a0..578facde 100644 --- a/tests/Integration/CachedBuilder/MorphOneTest.php +++ b/tests/Integration/CachedBuilder/MorphOneTest.php @@ -22,8 +22,8 @@ public function setUp() : void public function testMorphTo() { - $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_=_1-testing:{$this->testingSqlitePath}testing.sqlite:image"); - $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_=_4-testing:{$this->testingSqlitePath}testing.sqlite:image"); + $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_=_1-testing:{$this->testingSqlitePath}testing.sqlite:image:http://localhost"); + $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_=_4-testing:{$this->testingSqlitePath}testing.sqlite:image:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesimage", diff --git a/tests/Integration/CachedBuilder/PaginateTest.php b/tests/Integration/CachedBuilder/PaginateTest.php index 3c2fe261..2c83272d 100644 --- a/tests/Integration/CachedBuilder/PaginateTest.php +++ b/tests/Integration/CachedBuilder/PaginateTest.php @@ -17,7 +17,7 @@ public function testPaginationIsCached() $authors = (new Author) ->paginate(3); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-paginate_by_3_page_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-paginate_by_3_page_1"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -141,7 +141,7 @@ public function testPaginationWithCustomOptionsReturnsCorrectLinks() public function testCustomPageNamePagination() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-paginate_by_3_custom-page_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-paginate_by_3_custom-page_1"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/PolymorphicManyToManyTest.php b/tests/Integration/CachedBuilder/PolymorphicManyToManyTest.php index a837eb7f..8fe17ab7 100644 --- a/tests/Integration/CachedBuilder/PolymorphicManyToManyTest.php +++ b/tests/Integration/CachedBuilder/PolymorphicManyToManyTest.php @@ -8,7 +8,7 @@ class PolymorphicManyToManyTest extends IntegrationTestCase { public function testEagerloadedRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:posts:genealabslaravelmodelcachingtestsfixturespost-testing:{$this->testingSqlitePath}testing.sqlite:tags-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:posts:genealabslaravelmodelcachingtestsfixturespost-testing:{$this->testingSqlitePath}testing.sqlite:tags:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturespost", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturestag", @@ -35,7 +35,7 @@ public function testEagerloadedRelationship() public function testLazyloadedRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:posts:genealabslaravelmodelcachingtestsfixturespost-testing:{$this->testingSqlitePath}testing.sqlite:tags-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:posts:genealabslaravelmodelcachingtestsfixturespost-testing:{$this->testingSqlitePath}testing.sqlite:tags:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturespost", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturestag", diff --git a/tests/Integration/CachedBuilder/PolymorphicOneToManyTest.php b/tests/Integration/CachedBuilder/PolymorphicOneToManyTest.php index 0a28cdb4..496ef064 100644 --- a/tests/Integration/CachedBuilder/PolymorphicOneToManyTest.php +++ b/tests/Integration/CachedBuilder/PolymorphicOneToManyTest.php @@ -8,7 +8,7 @@ class PolymorphicOneToManyTest extends IntegrationTestCase { public function testEagerloadedRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-comments.commentable_id_inraw_1-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-comments.commentable_id_inraw_1-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturescomment", ]; @@ -37,7 +37,7 @@ public function testEagerloadedRelationship() public function testLazyloadedRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-comments.commentable_id_=_1-comments.commentable_id_notnull-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-comments.commentable_id_=_1-comments.commentable_id_notnull-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturescomment", ]; diff --git a/tests/Integration/CachedBuilder/PolymorphicOneToOneTest.php b/tests/Integration/CachedBuilder/PolymorphicOneToOneTest.php index 5c9f25fe..b31e2181 100644 --- a/tests/Integration/CachedBuilder/PolymorphicOneToOneTest.php +++ b/tests/Integration/CachedBuilder/PolymorphicOneToOneTest.php @@ -8,7 +8,7 @@ class PolymorphicOneToOneTest extends IntegrationTestCase { public function testEagerloadedRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:images:genealabslaravelmodelcachingtestsfixturesimage-images.imagable_id_inraw_2-images.imagable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\User"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:images:genealabslaravelmodelcachingtestsfixturesimage-images.imagable_id_inraw_2-images.imagable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\User:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesimage", ]; @@ -37,7 +37,7 @@ public function testEagerloadedRelationship() public function testLazyloadedHasOneThrough() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:images:genealabslaravelmodelcachingtestsfixturesimage-images.imagable_id_=_2-images.imagable_id_notnull-images.imagable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\User-limit_1"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:images:genealabslaravelmodelcachingtestsfixturesimage-images.imagable_id_=_2-images.imagable_id_notnull-images.imagable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\User-limit_1:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesimage", ]; diff --git a/tests/Integration/CachedBuilder/PrefixTest.php b/tests/Integration/CachedBuilder/PrefixTest.php index 9acc463e..25398fe1 100644 --- a/tests/Integration/CachedBuilder/PrefixTest.php +++ b/tests/Integration/CachedBuilder/PrefixTest.php @@ -8,11 +8,11 @@ class PrefixTest extends IntegrationTestCase { public function testCachePrefixIsAddedForPrefixedModel() { - $prefixKey = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null-first"); + $prefixKey = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null:http://localhost-first"); $prefixTags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:genealabslaravelmodelcachingtestsfixturesprefixedauthor", ]; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/ScopeTest.php b/tests/Integration/CachedBuilder/ScopeTest.php index 30096f35..70ecf75e 100644 --- a/tests/Integration/CachedBuilder/ScopeTest.php +++ b/tests/Integration/CachedBuilder/ScopeTest.php @@ -21,7 +21,7 @@ public function testScopeClauseParsing() $authors = (new Author) ->startsWithA() ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_like_A%-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_like_A%-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -44,7 +44,7 @@ public function testScopeClauseWithParameter() $authors = (new Author) ->nameStartsWith("B") ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_like_B%-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_like_B%-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -68,7 +68,7 @@ public function testGlobalScopesAreCached() ->first(); $authors = (new AuthorBeginsWithScoped) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthorbeginswithscoped-name_like_A%0=A%25"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthorbeginswithscoped-name_like_A%0=A%25:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthorbeginswithscoped"]; $cachedResults = $this->cache() @@ -90,7 +90,7 @@ public function testInlineGlobalScopesAreCached() ->first(); $authors = (new AuthorWithInlineGlobalScope) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthorwithinlineglobalscope-authors.deleted_at_null-name_like_A%0=A%25"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthorwithinlineglobalscope-authors.deleted_at_null-name_like_A%0=A%25:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthorwithinlineglobalscope"]; $cachedResults = $this->cache() @@ -182,7 +182,7 @@ public function testScopeNotAppliedTwice() ->create(["name" => "Anton Junior"]); $this->actingAs($user); DB::enableQueryLog(); - + (new AuthorBeginsWithScoped) ->get(); $queryLog = DB::getQueryLog(); diff --git a/tests/Integration/CachedBuilder/SelectTest.php b/tests/Integration/CachedBuilder/SelectTest.php index 05567570..71083af4 100644 --- a/tests/Integration/CachedBuilder/SelectTest.php +++ b/tests/Integration/CachedBuilder/SelectTest.php @@ -9,7 +9,7 @@ class SelectTest extends IntegrationTestCase { public function testSelectWithRawColumns() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_author_id_AVG(id) AS averageIds_orderBy_author_id_asc"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_author_id_AVG(id) AS averageIds_orderBy_author_id_asc:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -42,7 +42,7 @@ public function testSelectWithRawColumns() public function testSelectFieldsAreCached() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id_name-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id_name-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -67,7 +67,7 @@ public function testSelectFieldsAreCached() public function testAddSelectMethodOnModel() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_(SELECT id FROM authors WHERE id = 1)-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_(SELECT id FROM authors WHERE id = 1)-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -89,7 +89,7 @@ public function testAddSelectMethodOnModel() public function testAddSelectMethodOnBuilder() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_(SELECT id FROM authors WHERE id = 1)_(SELECT id FROM authors WHERE id = 1)-id_=_1-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_(SELECT id FROM authors WHERE id = 1)_(SELECT id FROM authors WHERE id = 1)-id_=_1-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/SoftDeletesTest.php b/tests/Integration/CachedBuilder/SoftDeletesTest.php index b5728f2b..00230f0a 100644 --- a/tests/Integration/CachedBuilder/SoftDeletesTest.php +++ b/tests/Integration/CachedBuilder/SoftDeletesTest.php @@ -11,7 +11,7 @@ public function testWithTrashedIsCached() $author = (new UncachedAuthor) ->first(); $author->delete(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-find_1-withTrashed"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost-find_1-withTrashed"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -36,7 +36,7 @@ public function testWithoutTrashedIsCached() $author = (new UncachedAuthor) ->first(); $author->delete(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-find_{$author->id}-withoutTrashed"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-find_{$author->id}-withoutTrashed"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -64,7 +64,7 @@ public function testonlyTrashedIsCached() $author = (new UncachedAuthor) ->first(); $author->delete(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_notnull-find_{$author->id}-onlyTrashed"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_notnull:http://localhost-find_{$author->id}-onlyTrashed"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/SubQueryAddSelectTest.php b/tests/Integration/CachedBuilder/SubQueryAddSelectTest.php index f23562aa..23dfaf10 100644 --- a/tests/Integration/CachedBuilder/SubQueryAddSelectTest.php +++ b/tests/Integration/CachedBuilder/SubQueryAddSelectTest.php @@ -11,7 +11,7 @@ class SubQueryAddSelectTest extends IntegrationTestCase { public function testAddSelect() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_books.*_(select \"name\" from \"publishers\" where \"id\" = \"books\".\"publisher_id\" order by \"published_at\" desc limit 1) as \"publisher_name\"-publisher_id_in_11_12_13_14_15"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook_books.*_(select \"name\" from \"publishers\" where \"id\" = \"books\".\"publisher_id\" order by \"published_at\" desc limit 1) as \"publisher_name\"-publisher_id_in_11_12_13_14_15:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/SubQueryOrderByTest.php b/tests/Integration/CachedBuilder/SubQueryOrderByTest.php index a733a416..0c2a0166 100644 --- a/tests/Integration/CachedBuilder/SubQueryOrderByTest.php +++ b/tests/Integration/CachedBuilder/SubQueryOrderByTest.php @@ -11,7 +11,7 @@ class SubQueryOrderByTest extends IntegrationTestCase { public function testOrderByDesc() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publisher_id_in_11_12_13_14_15_orderBy_(select \"name\" from \"publishers\" where \"id\" = \"books\".\"publisher_id\" limit 1)_desc"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publisher_id_in_11_12_13_14_15_orderBy_(select \"name\" from \"publishers\" where \"id\" = \"books\".\"publisher_id\" limit 1)_desc:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/WhenTest.php b/tests/Integration/CachedBuilder/WhenTest.php index 5c271a06..93bc2639 100644 --- a/tests/Integration/CachedBuilder/WhenTest.php +++ b/tests/Integration/CachedBuilder/WhenTest.php @@ -8,7 +8,7 @@ class WhenTest extends IntegrationTestCase { public function testWhenQuery() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_<_5"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_<_5:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/WhereHasMorphTest.php b/tests/Integration/CachedBuilder/WhereHasMorphTest.php index 7b2827a1..c9e52b83 100644 --- a/tests/Integration/CachedBuilder/WhereHasMorphTest.php +++ b/tests/Integration/CachedBuilder/WhereHasMorphTest.php @@ -22,7 +22,7 @@ public function testWithSingleMorphModel() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturescomment", ]) ->get(sha1( - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id" + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id:http://localhost" ))['value']; $this->assertCount(5, $comments); @@ -43,7 +43,7 @@ public function testWithMultipleMorphModels() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturescomment", ]) ->get(sha1( - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedPost-exists-and_comments.commentable_id_=_posts.id" + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedPost-exists-and_comments.commentable_id_=_posts.id:http://localhost" ))['value']; $this->assertCount(10, $comments); @@ -68,7 +68,7 @@ public function testWithMultipleMorphModelsWithClosure() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturescomment", ]) ->get(sha1( - "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id-subject_like_%uncached post-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedPost-exists-and_comments.commentable_id_=_posts.id-subject_like_%uncached post" + "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:comments:genealabslaravelmodelcachingtestsfixturescomment-nested-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\Post-exists-and_comments.commentable_id_=_posts.id-subject_like_%uncached post-nested-comments.commentable_type_=_GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedPost-exists-and_comments.commentable_id_=_posts.id-subject_like_%uncached post:http://localhost" ))['value']; $this->assertCount(5, $comments); diff --git a/tests/Integration/CachedBuilder/WhereInRawTest.php b/tests/Integration/CachedBuilder/WhereInRawTest.php index 20281aa6..c73ca195 100644 --- a/tests/Integration/CachedBuilder/WhereInRawTest.php +++ b/tests/Integration/CachedBuilder/WhereInRawTest.php @@ -8,7 +8,7 @@ class WhereInRawTest extends IntegrationTestCase { public function testWhereInRawUsingRelationship() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", diff --git a/tests/Integration/CachedBuilder/WhereInTest.php b/tests/Integration/CachedBuilder/WhereInTest.php index aa3bb0cc..e1c670d1 100644 --- a/tests/Integration/CachedBuilder/WhereInTest.php +++ b/tests/Integration/CachedBuilder/WhereInTest.php @@ -10,7 +10,7 @@ class WhereInTest extends IntegrationTestCase { public function testWhereInUsingCollectionQuery() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_in_1_2_3_4"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_in_1_2_3_4:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -35,7 +35,7 @@ public function testWhereInUsingCollectionQuery() public function testWhereInWhenSetIsEmpty() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_in_-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_in_-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -56,7 +56,7 @@ public function testWhereInWhenSetIsEmpty() public function testBindingsAreCorrectWithMultipleWhereInClauses() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_in_John-id_in_-name_in_Mike-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_in_John-id_in_-name_in_Mike-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -81,7 +81,7 @@ public function testBindingsAreCorrectWithMultipleWhereInClauses() public function testWhereInUsesCorrectBindings() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_in_1_2_3_4_5-id_between_1_99999-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_in_1_2_3_4_5-id_between_1_99999-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new Author) diff --git a/tests/Integration/CachedBuilder/WhereJsonContainsTest.php b/tests/Integration/CachedBuilder/WhereJsonContainsTest.php index 0d4edc56..2c4b8a2f 100644 --- a/tests/Integration/CachedBuilder/WhereJsonContainsTest.php +++ b/tests/Integration/CachedBuilder/WhereJsonContainsTest.php @@ -30,7 +30,7 @@ public function setUp() : void public function testWithInUsingCollectionQuery() { - $key = sha1("genealabs:laravel-model-caching:pgsql:testing:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->total_jsoncontains_5000-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:pgsql:testing:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->total_jsoncontains_5000-authors.deleted_at_null:http://localhost"); $tags = [ 'genealabs:laravel-model-caching:pgsql:testing:genealabslaravelmodelcachingtestsfixturesauthor', ]; @@ -56,7 +56,7 @@ public function testWithInUsingCollectionQuery() public function testWithInUsingCollectionQueryWithArrayValues() { - $key = sha1("genealabs:laravel-model-caching:pgsql:testing:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_jsoncontains_[\"foo\",\"bar\"]-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:pgsql:testing:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_jsoncontains_[\"foo\",\"bar\"]-authors.deleted_at_null:http://localhost"); $tags = [ 'genealabs:laravel-model-caching:pgsql:testing:genealabslaravelmodelcachingtestsfixturesauthor', ]; diff --git a/tests/Integration/CachedBuilder/WhereJsonLengthTest.php b/tests/Integration/CachedBuilder/WhereJsonLengthTest.php index 1fec6f94..cf7364d2 100644 --- a/tests/Integration/CachedBuilder/WhereJsonLengthTest.php +++ b/tests/Integration/CachedBuilder/WhereJsonLengthTest.php @@ -9,7 +9,7 @@ class WhereJsonLengthTest extends IntegrationTestCase public function testWithInUsingCollectionQueryNoOperator() { $length = 2; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_=_$length-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_=_$length-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -30,7 +30,7 @@ public function testWithInUsingCollectionQueryNoOperator() public function testWithInUsingCollectionQueryWithOperator() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_>_1-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-finances->tags_>_1-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; diff --git a/tests/Integration/CachedBuilder/WhereNotInTest.php b/tests/Integration/CachedBuilder/WhereNotInTest.php index 10f9b3f9..d44a4166 100644 --- a/tests/Integration/CachedBuilder/WhereNotInTest.php +++ b/tests/Integration/CachedBuilder/WhereNotInTest.php @@ -9,7 +9,7 @@ class WhereNotInTest extends IntegrationTestCase { public function testWhereNotInQuery() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_notin_1_2_3_4"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_notin_1_2_3_4:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -34,7 +34,7 @@ public function testWhereNotInQuery() public function testWhereNotInResults() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_1_2"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_1_2:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -55,7 +55,7 @@ public function testWhereNotInResults() public function testWhereNotInSubquery() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_select_id_from_authors_where_id_<_10"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_select_id_from_authors_where_id_<_10:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; diff --git a/tests/Integration/CachedBuilder/WhereRawTest.php b/tests/Integration/CachedBuilder/WhereRawTest.php index b48e4cdf..73680bd5 100644 --- a/tests/Integration/CachedBuilder/WhereRawTest.php +++ b/tests/Integration/CachedBuilder/WhereRawTest.php @@ -14,7 +14,7 @@ public function testRawWhereClauseParsing() ->whereRaw('name <> \'\'') ->first()]); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-_and_name_<>_''-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-_and_name_<>_''-authors.deleted_at_null:http://localhost-first"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = collect([$this->cache()->tags($tags)->get($key)['value']]); @@ -34,7 +34,7 @@ public function testWhereRawWithQueryParameters() ->whereRaw("name != 'test3'") ->whereRaw('name = ? AND name != ?', [$authorName, "test2"]) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_" . str_replace(" ", "_", $authorName) . "__AND_name_!=_test2-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_" . str_replace(" ", "_", $authorName) . "__AND_name_!=_test2-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = collect([$this->cache()->tags($tags)->get($key)['value']]); @@ -105,8 +105,8 @@ public function testWhereRawParametersCacheUniquely() $result2 = (new Book) ->whereRaw("id = ?", [$book2->id]) ->get(); - $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_{$book1->id}"); - $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_{$book2->id}"); + $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_{$book1->id}:http://localhost"); + $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-_and_id_=_{$book2->id}:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"]; $cachedBook1 = $this->cache()->tags($tags)->get($key1)['value']; $cachedBook2 = $this->cache()->tags($tags)->get($key2)['value']; @@ -128,8 +128,8 @@ public function testWhereRawParametersAfterWhereClause() ->where("id", ">", 1) ->whereRaw("id = ?", [$book2->id]) ->get(); - $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_>_0-_and_id_=_{$book1->id}"); - $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_>_1-_and_id_=_{$book2->id}"); + $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_>_0-_and_id_=_{$book1->id}:http://localhost"); + $key2 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_>_1-_and_id_=_{$book2->id}:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"]; $cachedBook1 = $this->cache()->tags($tags)->get($key1)['value']; $cachedBook2 = $this->cache()->tags($tags)->get($key2)['value']; diff --git a/tests/Integration/CachedBuilder/WhereTest.php b/tests/Integration/CachedBuilder/WhereTest.php index 3b2a84d2..3e3d3a03 100644 --- a/tests/Integration/CachedBuilder/WhereTest.php +++ b/tests/Integration/CachedBuilder/WhereTest.php @@ -34,7 +34,7 @@ public function testColumnsRelationshipWhereClauseParsing() $authors = (new Author) ->where('name', '=', $author->name) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_=_{$author->name}-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_=_{$author->name}-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -60,7 +60,7 @@ private function processWhereClauseTestWithOperator(string $operator) str_replace(' ', '_', strtolower($operator)), '_', $author->name, - "-authors.deleted_at_null" + "-authors.deleted_at_null:http://localhost" ]; $key = sha1(implode('', $keyParts)); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; @@ -89,7 +89,7 @@ public function testWhereClauseParsingOfOperators() public function testTwoWhereClausesAfterEachOther() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_>_0-id_<_100-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-id_>_0-id_<_100-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new Author) @@ -110,7 +110,7 @@ public function testTwoWhereClausesAfterEachOther() public function testWhereUsesCorrectBinding() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-nested-name_like_B%-name_like_G%-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-nested-name_like_B%-name_like_G%-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new Author) diff --git a/tests/Integration/CachedBuilder/WithTest.php b/tests/Integration/CachedBuilder/WithTest.php index ed428b50..234da0d3 100644 --- a/tests/Integration/CachedBuilder/WithTest.php +++ b/tests/Integration/CachedBuilder/WithTest.php @@ -79,7 +79,7 @@ public function testMultiLevelWithQuery() public function testWithBelongsToManyRelationshipQuery() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.id_=_3-testing:{$this->testingSqlitePath}testing.sqlite:stores-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.id_=_3-testing:{$this->testingSqlitePath}testing.sqlite:stores:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", diff --git a/tests/Integration/CachedBuilderRelationshipsTest.php b/tests/Integration/CachedBuilderRelationshipsTest.php index 2f5fa818..4f16e5cb 100644 --- a/tests/Integration/CachedBuilderRelationshipsTest.php +++ b/tests/Integration/CachedBuilderRelationshipsTest.php @@ -12,7 +12,7 @@ public function testHasRelationshipResults() ->with("stores") ->has("stores") ->get(); - $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-exists-and_books.id_=_book_store.book_id-testing:{$this->testingSqlitePath}testing.sqlite:stores"; + $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-exists-and_books.id_=_book_store.book_id-testing:{$this->testingSqlitePath}testing.sqlite:stores:http://localhost"; $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", diff --git a/tests/Integration/CachedBuilderTest.php b/tests/Integration/CachedBuilderTest.php index d000daca..a74eb6fa 100644 --- a/tests/Integration/CachedBuilderTest.php +++ b/tests/Integration/CachedBuilderTest.php @@ -32,7 +32,7 @@ public function testCacheIsNotEmptyAfterLoadingModels() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books")); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books:http://localhost")); $this->assertNotNull($results); } @@ -98,7 +98,7 @@ public function testHasManyRelationshipIsCached() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books"))['value']); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books:http://localhost"))['value']); $this->assertNotNull($results); $this->assertEmpty($authors->diffKeys($results)); @@ -115,7 +115,7 @@ public function testBelongsToRelationshipIsCached() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor" ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:author"))['value']); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:author:http://localhost"))['value']); $this->assertNotNull($results); $this->assertEmpty($books->diffKeys($results)); @@ -132,7 +132,7 @@ public function testBelongsToManyRelationshipIsCached() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore" ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:stores"))['value']); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:stores:http://localhost"))['value']); $this->assertNotNull($results); $this->assertEmpty($books->diffKeys($results)); @@ -150,7 +150,7 @@ public function testHasOneRelationshipIsCached() "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesprofile" ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:profile"))['value']); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost"))['value']); $this->assertNotNull($results); $this->assertEmpty($authors->diffKeys($results)); @@ -163,7 +163,7 @@ public function testAvgModelResultsCreatesCache() { $authorId = (new Author)->with('books', 'profile') ->avg('id'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-avg_id"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-avg_id"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -193,7 +193,7 @@ public function testChunkModelResultsCreatesCache() $offset = "-offset_" . (count($chunkedKeys) * 3); } - $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_authors.id_asc{$offset}-limit_3"; + $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_authors.id_asc{$offset}-limit_3:http://localhost"; array_push($chunkedAuthors, $authors); array_push($chunkedKeys, $key); }); @@ -217,7 +217,7 @@ public function testCountModelResultsCreatesCache() $authors = (new Author) ->with('books', 'profile') ->count(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-count"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-count"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -239,7 +239,7 @@ public function testCountWithStringCreatesCache() $authors = (new Author) ->with('books', 'profile') ->count("id"); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-count"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_id-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-count"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -260,7 +260,7 @@ public function testFirstModelResultsCreatesCache() { $author = (new Author) ->first(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -280,7 +280,7 @@ public function testMaxModelResultsCreatesCache() { $authorId = (new Author)->with('books', 'profile') ->max('id'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-max_id"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-max_id"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -300,7 +300,7 @@ public function testMinModelResultsCreatesCache() { $authorId = (new Author)->with('books', 'profile') ->min('id'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-min_id"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-min_id"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -320,7 +320,7 @@ public function testPluckModelResultsCreatesCache() { $authors = (new Author)->with('books', 'profile') ->pluck('name', 'id'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_name-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-pluck_name_id"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_name-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-pluck_name_id"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -340,7 +340,7 @@ public function testSumModelResultsCreatesCache() { $authorId = (new Author)->with('books', 'profile') ->sum('id'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-sum_id"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-sum_id"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -360,7 +360,7 @@ public function testValueModelResultsCreatesCache() { $authorName = (new Author)->with('books', 'profile') ->value('name'); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile-value_name"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-testing:{$this->testingSqlitePath}testing.sqlite:profile:http://localhost-value_name"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -381,7 +381,7 @@ public function testNestedRelationshipEagerLoading() $authors = collect([(new Author)->with('books.publisher') ->first()]); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-books.publisher-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-books.publisher:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -400,7 +400,7 @@ public function testNestedRelationshipEagerLoading() public function testLazyLoadedRelationshipResolvesThroughCachedBuilder() { $books = (new Author)->first()->books; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -421,7 +421,7 @@ public function testLazyLoadingOnResourceIsCached() } $books = (new AuthorResource((new Author)->first()))->books; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -439,7 +439,7 @@ public function testOrderByClauseParsing() { $authors = (new Author)->orderBy('name')->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_name_asc"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_name_asc:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -459,7 +459,7 @@ public function testNestedRelationshipWhereClauseParsing() ->with('books.publisher') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-books.publisher"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books-books.publisher:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -482,7 +482,7 @@ public function testExistsRelationshipWhereClauseParsing() $authors = (new Author)->whereHas('books') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-exists-and_authors.id_=_books.author_id-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-exists-and_authors.id_=_books.author_id-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -501,7 +501,7 @@ public function testDoesntHaveWhereClauseParsing() ->doesntHave('books') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-notexists-and_authors.id_=_books.author_id-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-notexists-and_authors.id_=_books.author_id-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -521,7 +521,7 @@ public function testRelationshipQueriesAreCached() ->first() ->books() ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-books.author_id_=_1-books.author_id_notnull:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" ]; @@ -544,7 +544,7 @@ public function testRawOrderByWithoutColumnReference() ->orderByRaw('DATE()') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderByRaw_date"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderByRaw_date:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this->cache() @@ -567,7 +567,7 @@ public function testDelete() ->first(); $authorId = $author->id; $liveResultId = $liveResult->id; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-first"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $author->delete(); @@ -588,7 +588,7 @@ public function testWhereBetweenIdsResults() $books = (new Book) ->whereBetween('price', [5, 10]) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-price_between_5_10"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-price_between_5_10:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -609,7 +609,7 @@ public function testWhereBetweenDatesResults() $books = (new Book) ->whereBetween('created_at', ['2018-01-01', '2018-12-31']) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-created_at_between_2018-01-01_2018-12-31"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-created_at_between_2018-01-01_2018-12-31:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -630,7 +630,7 @@ public function testWhereDatesResults() $books = (new Book) ->whereDate('created_at', '>=', '2018-01-01') ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-created_at_>=_2018-01-01"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-created_at_>=_2018-01-01:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", ]; @@ -648,7 +648,7 @@ public function testWhereDatesResults() public function testHashCollision() { - $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_1_2"); + $key1 = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-id_notin_1_2:http://localhost"); $tags1 = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"]; $books = (new Book) ->whereNotIn('id', [1, 2]) @@ -658,7 +658,7 @@ public function testHashCollision() $authors = (new Author) ->disableCache() ->get(); - $key2 = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor"; + $key2 = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"; $this->cache() ->tags($tags1) ->rememberForever( @@ -684,7 +684,7 @@ function () use ($key2, $authors) { public function testSubsequentDisabledCacheQueriesDoNotCache() { (new Author)->disableCache()->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedAuthors1 = $this->cache() ->tags($tags) diff --git a/tests/Integration/CachedModelTest.php b/tests/Integration/CachedModelTest.php index af6e2524..2b94dd57 100644 --- a/tests/Integration/CachedModelTest.php +++ b/tests/Integration/CachedModelTest.php @@ -13,7 +13,7 @@ class CachedModelTest extends IntegrationTestCase public function testAllModelResultsCreatesCache() { $authors = (new Author)->all(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -31,7 +31,7 @@ public function testAllModelResultsCreatesCache() public function testScopeDisablesCaching() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new Author) ->where("name", "Bruno") @@ -49,7 +49,7 @@ public function testScopeDisablesCaching() public function testScopeDisablesCachingWhenCalledOnModel() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:authors:genealabslaravelmodelcachingtestsfixturesauthor"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new PrefixedAuthor) ->disableCache() @@ -68,7 +68,7 @@ public function testScopeDisablesCachingWhenCalledOnModel() public function testScopeDisableCacheDoesntCrashWhenCachingIsDisabledInConfig() { config(['laravel-model-caching.enabled' => false]); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:authors:genealabslaravelmodelcachingtestsfixturesauthor"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:test-prefix:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new PrefixedAuthor) ->where("name", "Bruno") @@ -89,7 +89,7 @@ public function testAllMethodCachingCanBeDisabledViaConfig() config(['laravel-model-caching.enabled' => false]); $authors = (new Author) ->all(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor.deleted_at_null:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -115,7 +115,7 @@ public function testWhereHasIsBeingCached() }) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-exists-and_books.author_id_=_authors.id-id_=_1-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:author"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-exists-and_books.author_id_=_authors.id-id_=_1-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:author:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", @@ -169,7 +169,7 @@ public function testCooldownIsQueriedForCooldownModels() $author = (new AuthorWithCooldown) ->withCacheCooldownSeconds(1) ->first(); - + [$usesCacheCooldown, $expiresAt, $savedAt] = $method->invokeArgs($author, [$author]); $this->assertEquals($usesCacheCooldown, 1); diff --git a/tests/Integration/Console/Commands/FlushTest.php b/tests/Integration/Console/Commands/FlushTest.php index 63f929e2..dbb4b07c 100644 --- a/tests/Integration/Console/Commands/FlushTest.php +++ b/tests/Integration/Console/Commands/FlushTest.php @@ -22,7 +22,7 @@ public function setUp() : void public function testGivenModelIsFlushed() { $authors = (new Author)->all(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedResults = $this @@ -48,7 +48,7 @@ public function testExtendedModelIsFlushed() $authors = (new PrefixedAuthor) ->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:genealabslaravelmodelcachingtestsfixturesprefixedauthor"]; $cachedResults = $this @@ -72,7 +72,7 @@ public function testExtendedModelIsFlushed() public function testGivenModelWithRelationshipIsFlushed() { $authors = (new Author)->with('books')->get(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books:http://localhost"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", @@ -114,17 +114,17 @@ public function testAllModelsAreFlushed() (new Book)->all(); (new Store)->all(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedAuthors = $this->cache ->tags($tags) ->get($key)['value']; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"]; $cachedBooks = $this->cache ->tags($tags) ->get($key)['value']; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore"]; $cachedStores = $this->cache ->tags($tags) @@ -137,19 +137,19 @@ public function testAllModelsAreFlushed() $this->artisan('modelCache:clear') ->execute(); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $cachedAuthors = $this->cache ->tags($tags) ->get($key)['value'] ?? null; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"]; $cachedBooks = $this->cache ->tags($tags) ->get($key)['value'] ?? null; - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingtestsfixturesstore:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore"]; $cachedStores = $this->cache ->tags($tags) diff --git a/tests/Integration/HelperTest.php b/tests/Integration/HelperTest.php index cf52373f..29ce2ffc 100644 --- a/tests/Integration/HelperTest.php +++ b/tests/Integration/HelperTest.php @@ -8,7 +8,7 @@ class HelperTest extends IntegrationTestCase { public function testClosureRunsWithCacheDisabled() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = app("model-cache")->runDisabled(function () { diff --git a/tests/Integration/Traits/CachableTest.php b/tests/Integration/Traits/CachableTest.php index 10950778..1d87fd1f 100644 --- a/tests/Integration/Traits/CachableTest.php +++ b/tests/Integration/Traits/CachableTest.php @@ -24,7 +24,7 @@ public function testSpecifyingAlternateCacheDriver() // TODO: make sure the alternate cache is actually loaded config(['cache.stores' => $configCacheStores]); config(['laravel-model-caching.store' => 'customCache']); - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"); $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"]; $authors = (new Author) @@ -55,7 +55,7 @@ public function testSetCachePrefixAttribute() ->tags([ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:genealabslaravelmodelcachingtestsfixturesprefixedauthor", ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null"))['value']; + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:model-prefix:authors:genealabslaravelmodelcachingtestsfixturesprefixedauthor-authors.deleted_at_null:http://localhost"))['value']; $this->assertNotNull($results); } @@ -71,7 +71,7 @@ public function testAllReturnsCollection() ->tags([ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null"))['value']; + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost"))['value']; $liveResults = (new UncachedAuthor)->all(); $this->assertInstanceOf(Collection::class, $authors); @@ -89,7 +89,7 @@ public function testsCacheFlagDisablesCaching() ->tags([ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]) - ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null")); + ->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost")); config(['laravel-model-caching.enabled' => true]); diff --git a/tests/Integration/Traits/CachePrefixingTest.php b/tests/Integration/Traits/CachePrefixingTest.php index 22143153..9fb17304 100644 --- a/tests/Integration/Traits/CachePrefixingTest.php +++ b/tests/Integration/Traits/CachePrefixingTest.php @@ -8,7 +8,7 @@ class CachePrefixingTest extends IntegrationTestCase { public function testDatabaseKeyingEnabled() { - $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-first"); $tags = [ "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", ]; @@ -31,7 +31,7 @@ public function testDatabaseKeyingEnabled() public function testDatabaseKeyingDisabled() { config(["laravel-model-caching.use-database-keying" => false]); - $key = sha1("genealabs:laravel-model-caching:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-first"); + $key = sha1("genealabs:laravel-model-caching:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost-first"); $tags = ["genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor"]; $author = (new Author)