Skip to content

Commit 76d4d66

Browse files
committed
ITT: assertEloquentHasCreateManyRelationsMethod readme info added.
1 parent 324c96c commit 76d4d66

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Provides Laravel-specific testing helpers and asserts.
9898
- [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
9999
- [assertEloquentHasMany](#asserteloquenthasmany)
100100
- [assertEloquentHasCreateRelationMethod](#asserteloquenthascreaterelationmethod)
101+
- [assertEloquentHasCreateManyRelationsMethod](#asserteloquenthascreatemanyrelationsmethod)
101102
- [assertEloquentBelongsTo](#asserteloquentbelongsto)
102103
- [ExceptionAsserts](#exceptionasserts)
103104
- [willSeeException](#willseeexception)
@@ -426,7 +427,7 @@ class Post extends Model
426427

427428
> NOTE: In order to use this assertion, you have to create model factories for both classes.
428429
429-
Checks if Eloquent model has create method for specified `HasMany` relation:
430+
Checks if Eloquent model has `create` method for specified `HasMany` relation:
430431

431432
```php
432433
$this->assertEloquentHasCreateRelationMethod(Post::class, 'comments');
@@ -444,6 +445,28 @@ class Post extends Model
444445
}
445446
```
446447

448+
#### `assertEloquentHasCreateManyRelationsMethod()`
449+
450+
> NOTE: In order to use this assertion, you have to create model factories for both classes.
451+
452+
Checks if Eloquent model has `createMany` method for specified `HasMany` relation:
453+
454+
```php
455+
$this->assertEloquentHasCreateManyRelationsMethod(Post::class, 'comments');
456+
```
457+
458+
Assuming that `Post` class has `createManyComments` method:
459+
460+
```php
461+
class Post extends Model
462+
{
463+
public function createManyComments(array $comments)
464+
{
465+
return $this->comments()->createMany($comments);
466+
}
467+
}
468+
```
469+
447470
#### `assertEloquentBelongsTo()`
448471

449472
> NOTE: In order to use this assertion, you have to create model factories for both classes.

0 commit comments

Comments
 (0)