File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ Provides Laravel-specific testing helpers and asserts.
9898 - [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
9999 - [assertEloquentHasMany](#asserteloquenthasmany)
100100 - [assertEloquentHasCreateRelationMethod](#asserteloquenthascreaterelationmethod)
101+ - [assertEloquentBelongsTo](#asserteloquentbelongsto)
101102- [ExceptionAsserts](#exceptionasserts)
102103 - [willSeeException](#willseeexception)
103104- [FilesystemAsserts](#filesystemasserts)
@@ -443,6 +444,28 @@ class Post extends Model
443444}
444445```
445446
447+ #### ` assertEloquentBelongsTo() `
448+
449+ > NOTE: In order to use this assertion, you have to create model factories for both classes.
450+
451+ Checks if Eloquent model has specified ` BelongsTo ` relation:
452+
453+ ``` php
454+ $this->assertEloquentBelongsTo(Comment::class, 'post');
455+ ```
456+
457+ Assuming that ` Comment ` class has ` post ` relation:
458+
459+ ``` php
460+ class Comment extends Model
461+ {
462+ public function post()
463+ {
464+ return $this->belongsTo(Post::class);
465+ }
466+ }
467+ ```
468+
446469### ExceptionAsserts
447470
448471#### ` willSeeException() `
You can’t perform that action at this time.
0 commit comments