From 4c1db6c9332ad8622208ed6a3ac64e51aa86829f Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 12 Oct 2017 21:21:52 -0400 Subject: [PATCH] added testNestedRelationshipWhereClauseParsing --- tests/Unit/CachedBuilderTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/Unit/CachedBuilderTest.php b/tests/Unit/CachedBuilderTest.php index a07e1f4..76cd6db 100644 --- a/tests/Unit/CachedBuilderTest.php +++ b/tests/Unit/CachedBuilderTest.php @@ -482,8 +482,22 @@ public function testOrderByClauseParsing() public function testNestedRelationshipWhereClauseParsing() { - // -> with('modelA.modelB') - $this->markTestIncomplete(); + $authors = collect([(new Author) + ->with('books.publisher')->where('name','<>','')->first()]); + + $key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_-books-books.publisher-first'; + $tags = [ + 'genealabslaravelmodelcachingtestsfixturesauthor', + 'genealabslaravelmodelcachingtestsfixturesbook', + 'genealabslaravelmodelcachingtestsfixturespublisher', + ]; + + $cachedResults = collect([cache()->tags($tags)->get($key)]); + + $liveResults = collect([(new UncachedAuthor)->with('books.publisher')->where('name','<>','')->first()]); + + $this->assertEmpty($authors->diffAssoc($cachedResults)); + $this->assertEmpty($liveResults->diffAssoc($cachedResults)); } public function testExistsRelationshipWhereClauseParsing()