Skip to content

Commit ed66393

Browse files
committed
Update column where test
1 parent cc187f0 commit ed66393

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

Diff for: tests/Unit/CachedBuilderTest.php

+22-18
Original file line numberDiff line numberDiff line change
@@ -504,34 +504,38 @@ public function testNestedRelationshipWhereClauseParsing()
504504

505505
public function testExistsRelationshipWhereClauseParsing()
506506
{
507+
$authors = (new Author)->whereHas('books')
508+
->get();
507509

508-
$authors = collect([(new Author)->whereHas('books')->first()]);
509-
510-
$key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id-first';
510+
$key = 'genealabslaravelmodelcachingtestsfixturesauthor_and_authors.id_=_books.author_id';
511511
$tags = ['genealabslaravelmodelcachingtestsfixturesauthor'];
512512

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());
513+
$cachedResults = cache()->tags($tags)->get($key);
514+
$liveResults = (new UncachedAuthor)->whereHas('books')
515+
->get();
520516

517+
$this->assertEmpty($authors->diffAssoc($cachedResults));
518+
$this->assertEmpty($liveResults->diffAssoc($cachedResults));
521519
}
522520

523521
public function testColumnsRelationshipWhereClauseParsing()
524522
{
525-
$author = (new Author)->orderBy('name')->first();
526-
527-
$authors = collect([(new Author)->where('name', '=', $author->name)->first()]);
528-
529-
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_' . $author->name . '-first';
523+
$author = (new Author)
524+
->orderBy('name')
525+
->first();
526+
$authors = (new Author)
527+
->where('name', '=', $author->name)
528+
->get();
529+
$key = 'genealabslaravelmodelcachingtestsfixturesauthor-name_' .
530+
$author->name;
530531
$tags = ['genealabslaravelmodelcachingtestsfixturesauthor'];
531532

532-
$cachedResults = collect([cache()->tags($tags)->get($key)]);
533-
534-
$liveResults = collect([(new UncachedAuthor)->where('name', '=', $author->name)->first()]);
533+
$cachedResults = cache()
534+
->tags($tags)
535+
->get($key);
536+
$liveResults = (new UncachedAuthor)
537+
->where('name', '=', $author->name)
538+
->get();
535539

536540
$this->assertEmpty($authors->diffAssoc($cachedResults));
537541
$this->assertEmpty($liveResults->diffAssoc($cachedResults));

0 commit comments

Comments
 (0)