Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 30, 2020
1 parent d09c48f commit c613a18
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Database/DatabaseEloquentCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,24 @@ public function testQueueableCollectionImplementationThrowsExceptionOnMultipleMo
$c->getQueueableClass();
}

public function testQueueableRelationshipsReturnsOnlyRelationsCommonToAllModels()
{
// This is needed to prevent loading non-existing relationships on polymorphic model collections (#26126)
$c = new Collection([new class {
public function getQueueableRelations()
{
return ['user'];
}
}, new class {
public function getQueueableRelations()
{
return ['user', 'comments'];
}
}]);

$this->assertEquals(['user'], $c->getQueueableRelations());
}

public function testEmptyCollectionStayEmptyOnFresh()
{
$c = new Collection;
Expand Down

0 comments on commit c613a18

Please sign in to comment.