File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ Provides Laravel-specific testing helpers and asserts.
9797 - [assertEloquentTouchesEquals](#asserteloquenttouchesequals)
9898 - [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
9999 - [assertEloquentHasMany](#asserteloquenthasmany)
100+ - [assertEloquentHasCreateRelationMethod](#asserteloquenthascreaterelationmethod)
100101- [ExceptionAsserts](#exceptionasserts)
101102 - [willSeeException](#willseeexception)
102103- [FilesystemAsserts](#filesystemasserts)
@@ -408,6 +409,26 @@ Checks if Eloquent model has specified `HasMany` relation:
408409$this->assertEloquentHasMany(Post::class, 'comments');
409410```
410411
412+ #### ` assertEloquentHasCreateRelationMethod() `
413+
414+ > NOTE: In order to use this assertion, you have to create model factories for both classes.
415+
416+ Checks if Eloquent model has create method for specified ` HasMany ` relation:
417+
418+ ``` php
419+ $this->assertEloquentHasCreateRelationMethod(Post::class, 'comments');
420+
421+ // Assuming that `Post` class has `createComment` method
422+
423+ class Post extends Model
424+ {
425+ public function createComment(array $comment)
426+ {
427+ return $this->comments()->create($comment);
428+ }
429+ }
430+ ```
431+
411432### ExceptionAsserts
412433
413434#### ` willSeeException() `
You can’t perform that action at this time.
0 commit comments