Skip to content

Commit 77732eb

Browse files
committed
Add test to make sure find(1) and find([1]) don't return the same result
1 parent d1947f2 commit 77732eb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/Integration/CachedBuilder/FindTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public function testFindModelResultsCreatesCache()
3535

3636
public function testFindMultipleModelResultsCreatesCache()
3737
{
38-
$authors = (new Author)->find([1, 2, 3]);
38+
$authors = (new Author)
39+
->find([1, 2, 3]);
3940
$key = sha1('genealabs:laravel-model-caching:testing::memory::authors:genealabslaravelmodelcachingtestsfixturesauthor-find_list_1_2_3');
4041
$tags = [
4142
'genealabs:laravel-model-caching:testing::memory::genealabslaravelmodelcachingtestsfixturesauthor',
@@ -69,4 +70,16 @@ public function testFindWithArrayReturnsResults()
6970
$this->assertEquals($uncachedAuthor->count(), $author->count());
7071
$this->assertEquals($uncachedAuthor->pluck("id"), $author->pluck("id"));
7172
}
73+
74+
public function testFindWithSingleElementArrayDoesntConflictWithNormalFind()
75+
{
76+
$author1 = (new Author)
77+
->find(1);
78+
$author2 = (new Author)
79+
->find([1]);
80+
81+
$this->assertNotEquals($author1, $author2);
82+
$this->assertIsIterable($author2);
83+
$this->assertEquals(Author::class, get_class($author1));
84+
}
7285
}

0 commit comments

Comments
 (0)