Skip to content

Commit

Permalink
ITT: assertEloquentHasCreateManyRelationsMethod renamed to `assertE…
Browse files Browse the repository at this point in the history
…loquentHasCreateManyFor`.
  • Loading branch information
dmitry-ivanov committed Mar 17, 2017
1 parent 6c479d7 commit f09de15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Provides Laravel-specific testing helpers and asserts.
- [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
- [assertEloquentHasMany](#asserteloquenthasmany)
- [assertEloquentHasCreateFor](#asserteloquenthascreatefor)
- [assertEloquentHasCreateManyRelationsMethod](#asserteloquenthascreatemanyrelationsmethod)
- [assertEloquentHasCreateManyFor](#asserteloquenthascreatemanyfor)
- [assertEloquentBelongsTo](#asserteloquentbelongsto)
- [ExceptionAsserts](#exceptionasserts)
- [willSeeException](#willseeexception)
Expand Down Expand Up @@ -445,14 +445,14 @@ class Post extends Model
}
```

#### `assertEloquentHasCreateManyRelationsMethod()`
#### `assertEloquentHasCreateManyFor()`

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

```php
$this->assertEloquentHasCreateManyRelationsMethod(Post::class, 'comments');
$this->assertEloquentHasCreateManyFor(Post::class, 'comments');
```

Assuming that `Post` class has `createManyComments` method:
Expand Down
2 changes: 1 addition & 1 deletion src/Asserts/EloquentAsserts.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function assertEloquentHasCreateFor($class, $relation, $createMethod =
$this->assertEquals($child->fresh()->toArray(), $parent->{$relation}->first()->toArray());
}

protected function assertEloquentHasCreateManyRelationsMethod($class, $relation, $createManyMethod = null)
protected function assertEloquentHasCreateManyFor($class, $relation, $createManyMethod = null)
{
$this->assertMethodExists($class, $relation);

Expand Down
6 changes: 3 additions & 3 deletions tests/TestingTools/Asserts/EloquentAssertsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public function which_supports_optional_parameter_for_specifying_custom_create_m
}

/** @test */
public function it_has_eloquent_has_create_many_relations_method_assertion()
public function it_has_eloquent_has_create_many_for_assertion()
{
$this->assertEloquentHasCreateManyRelationsMethod(Post::class, 'comments');
$this->assertEloquentHasCreateManyFor(Post::class, 'comments');
}

/** @test */
public function which_also_supports_optional_parameter_for_specifying_custom_create_many_method_name()
{
$this->assertEloquentHasCreateManyRelationsMethod(Post::class, 'comments', 'attachManyComments');
$this->assertEloquentHasCreateManyFor(Post::class, 'comments', 'attachManyComments');
}

/** @test */
Expand Down

0 comments on commit f09de15

Please sign in to comment.