Skip to content

Commit

Permalink
ITT: assertEloquentBelongsTo readme added.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ivanov committed Mar 16, 2017
1 parent 9e6a353 commit a311e25
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Provides Laravel-specific testing helpers and asserts.
- [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
- [assertEloquentHasMany](#asserteloquenthasmany)
- [assertEloquentHasCreateRelationMethod](#asserteloquenthascreaterelationmethod)
- [assertEloquentBelongsTo](#asserteloquentbelongsto)
- [ExceptionAsserts](#exceptionasserts)
- [willSeeException](#willseeexception)
- [FilesystemAsserts](#filesystemasserts)
Expand Down Expand Up @@ -443,6 +444,28 @@ class Post extends Model
}
```

#### `assertEloquentBelongsTo()`

> NOTE: In order to use this assertion, you have to create model factories for both classes.
Checks if Eloquent model has specified `BelongsTo` relation:

```php
$this->assertEloquentBelongsTo(Comment::class, 'post');
```

Assuming that `Comment` class has `post` relation:

```php
class Comment extends Model
{
public function post()
{
return $this->belongsTo(Post::class);
}
}
```

### ExceptionAsserts

#### `willSeeException()`
Expand Down

0 comments on commit a311e25

Please sign in to comment.