Skip to content

Commit

Permalink
allow relation without related model (morphTo case)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarektkaczyk committed Jul 17, 2018
1 parent b2b3990 commit 58ab7d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/EloquentSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ trait EloquentSuite
*
* @param string $model Classname of the model under test
* @param string $relation Relation method (belongsTo, hasMany etc)
* @param string $related Classname of the related model
* @param string|null $related Classname of the related model
* @param ...string $params Optional params for the relation
* @return \PHPUnit\Framework\MockObject\MockObject[]
*/
public function createRelationMock(string $model, string $relation, string $related, ...$params) : MockObject
public function createRelationMock(string $model, string $relation, string $related = null, ...$params) : MockObject
{
return $this->createRelationChainMock($model, $relation, $related, ...$params)[0];
}
Expand Down Expand Up @@ -82,11 +82,11 @@ public function createRelationMock(string $model, string $relation, string $rela
*
* @param string $model Classname of the model under test
* @param string $relation Relation method (belongsTo, hasMany etc)
* @param string $related Classname of the related model
* @param string|null $related Classname of the related model
* @param ...string $params Optional params for the relation
* @return [\PHPUnit\Framework\MockObject\MockObject, \Mockery\MockInterface]
*/
public function createRelationChainMock(string $model, string $relation, string $related, ...$params) : array
public function createRelationChainMock(string $model, string $relation, string $related = null, ...$params) : array
{
if (!array_key_exists($relation, self::$eloquent_relations)) {
$this->fail('Unknown relation provided: ' . $relation);
Expand Down

0 comments on commit 58ab7d3

Please sign in to comment.