Skip to content

Commit 84092bb

Browse files
author
fentie
committed
adding test for where column parsing
1 parent e0524cd commit 84092bb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/Unit/CachedBuilderTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,19 @@ public function testExistsRelationshipWhereClauseParsing()
510510

511511
public function testColumnsRelationshipWhereClauseParsing()
512512
{
513-
// ???
514-
$this->markTestIncomplete();
513+
$author = (new Author)->orderBy('name')->first();
514+
515+
$authors = collect([(new Author)->where('name', '=', $author->name)->first()]);
516+
517+
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_' . $author->name . '-first';
518+
$tags = ['genealabslaravelmodelcachingtestsfixturesauthor'];
519+
520+
$cachedResults = collect([cache()->tags($tags)->get($key)]);
521+
522+
$liveResults = collect([(new UncachedAuthor)->where('name', '=', $author->name)->first()]);
523+
524+
$this->assertEmpty($authors->diffAssoc($cachedResults));
525+
$this->assertEmpty($liveResults->diffAssoc($cachedResults));
515526
}
516527

517528
public function testRawWhereClauseParsing()

0 commit comments

Comments
 (0)