Skip to content

Commit c35193b

Browse files
committed
Implementing testExistsRelationshipWhereClauseParsing test
1 parent 2b3f63a commit c35193b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: tests/Unit/CachedBuilderTest.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,20 @@ public function testNestedRelationshipWhereClauseParsing()
504504

505505
public function testExistsRelationshipWhereClauseParsing()
506506
{
507-
// ->whereHas(...)
508-
$this->markTestIncomplete();
507+
508+
$authors = collect([(new Author)->whereHas('books')->first()]);
509+
510+
$key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id-first';
511+
$tags = ['genealabslaravelmodelcachingtestsfixturesauthor'];
512+
513+
$cachedResults = collect([cache()->tags($tags)->get($key)]);
514+
515+
$liveResults = collect([(new UncachedAuthor)
516+
->whereHas('books')->first()]);
517+
518+
$this->assertTrue($authors->diffAssoc($cachedResults)->isEmpty());
519+
$this->assertTrue($liveResults->diffAssoc($cachedResults)->isEmpty());
520+
509521
}
510522

511523
public function testColumnsRelationshipWhereClauseParsing()

0 commit comments

Comments
 (0)