Skip to content

Commit 7640eb6

Browse files
authored
Merge pull request #20 from allenjd3/master
added testNestedRelationshipWhereClauseParsing
2 parents 12475f2 + 4c1db6c commit 7640eb6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: tests/Unit/CachedBuilderTest.php

+16-2
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,22 @@ public function testOrderByClauseParsing()
482482

483483
public function testNestedRelationshipWhereClauseParsing()
484484
{
485-
// -> with('modelA.modelB')
486-
$this->markTestIncomplete();
485+
$authors = collect([(new Author)
486+
->with('books.publisher')->where('name','<>','')->first()]);
487+
488+
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_-books-books.publisher-first';
489+
$tags = [
490+
'genealabslaravelmodelcachingtestsfixturesauthor',
491+
'genealabslaravelmodelcachingtestsfixturesbook',
492+
'genealabslaravelmodelcachingtestsfixturespublisher',
493+
];
494+
495+
$cachedResults = collect([cache()->tags($tags)->get($key)]);
496+
497+
$liveResults = collect([(new UncachedAuthor)->with('books.publisher')->where('name','<>','')->first()]);
498+
499+
$this->assertEmpty($authors->diffAssoc($cachedResults));
500+
$this->assertEmpty($liveResults->diffAssoc($cachedResults));
487501
}
488502

489503
public function testExistsRelationshipWhereClauseParsing()

0 commit comments

Comments
 (0)