Skip to content

Commit d1947f2

Browse files
committed
Add test to make sure first() is not the same as all()
1 parent 57ebf74 commit d1947f2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/Integration/CachedBuilder/FirstTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,27 @@ class FirstTest extends IntegrationTestCase
1919
{
2020
public function testFirstReturnsAllAttributesForModel()
2121
{
22-
$author = (new Author)->where("id", "=", 1)->first();
23-
$uncachedAuthor = (new UncachedAuthor)->where("id", "=", 1)->first();
22+
$author = (new Author)
23+
->where("id", "=", 1)
24+
->first();
25+
$uncachedAuthor = (new UncachedAuthor)
26+
->where("id", "=", 1)
27+
->first();
2428

2529
$this->assertEquals($author->id, $uncachedAuthor->id);
2630
$this->assertEquals($author->created_at, $uncachedAuthor->created_at);
2731
$this->assertEquals($author->updated_at, $uncachedAuthor->updated_at);
2832
$this->assertEquals($author->email, $uncachedAuthor->email);
2933
$this->assertEquals($author->name, $uncachedAuthor->name);
3034
}
35+
36+
public function testFirstIsNotTheSameAsAll()
37+
{
38+
$authors = (new Author)
39+
->all();
40+
$author = (new Author)
41+
->first();
42+
43+
$this->assertNotEquals($authors, $author);
44+
}
3145
}

0 commit comments

Comments
 (0)