Skip to content

Commit 6f4dcb5

Browse files
committed
ITT: assertEloquentHasMany readme info added.
1 parent d98d561 commit 6f4dcb5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Provides Laravel-specific testing helpers and asserts.
9696
- [assertEloquentFillableNotEquals](#asserteloquentfillablenotequals)
9797
- [assertEloquentTouchesEquals](#asserteloquenttouchesequals)
9898
- [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
99+
- [assertEloquentHasMany](#asserteloquenthasmany)
99100
- [ExceptionAsserts](#exceptionasserts)
100101
- [willSeeException](#willseeexception)
101102
- [FilesystemAsserts](#filesystemasserts)
@@ -386,17 +387,27 @@ $this->assertEloquentFillableNotEquals(Post::class, ['title', 'body']);
386387
Checks if Eloquent model touched relations are equal to specified value:
387388

388389
```php
389-
$this->assertEloquentTouchesEquals(Post::class, ['comment']);
390+
$this->assertEloquentTouchesEquals(Comment::class, ['post']);
390391
```
391392

392393
#### `assertEloquentTouchesNotEquals()`
393394

394395
Checks if Eloquent model touched relations are not equal to specified value:
395396

396397
```php
397-
$this->assertEloquentTouchesNotEquals(Post::class, ['user']);
398+
$this->assertEloquentTouchesNotEquals(Comment::class, ['user']);
398399
```
399400

401+
#### `assertEloquentHasMany()`
402+
403+
Checks if Eloquent model has specified `HasMany` relation:
404+
405+
```php
406+
$this->assertEloquentHasMany(Post::class, 'comments');
407+
```
408+
409+
> NOTE: In order to use this assertion, you have to create model factories for both classes.
410+
400411
### ExceptionAsserts
401412

402413
#### `willSeeException()`

0 commit comments

Comments
 (0)