Skip to content

Commit 80a5d8b

Browse files
authored
Assert the model has a HasOne relationship
1 parent 0108e6d commit 80a5d8b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/RelationshipTestHelper.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ public function hasMany($model, $name = null)
7272
HasMany::class, $model, $name ?: $this->getRelationshipMethodName($model, false)
7373
);
7474
}
75+
76+
/**
77+
* Assert the model has a has one relationship.
78+
*
79+
* @param string $model
80+
* @param string|null $name
81+
* @return bool
82+
*/
83+
public function hasOne($model, $name = null)
84+
{
85+
return $this->assertHasRelationship(
86+
HasOne::class, $model, $name ?: $this->getRelationshipMethodName($model, false)
87+
);
88+
}
7589

7690
/**
7791
* Assert the model has a morphs to relationship.

0 commit comments

Comments
 (0)