From f09de159fead18799a4686e19ff5fba867ce6870 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Fri, 17 Mar 2017 12:40:21 +0200 Subject: [PATCH] ITT: `assertEloquentHasCreateManyRelationsMethod` renamed to `assertEloquentHasCreateManyFor`. --- README.md | 6 +++--- src/Asserts/EloquentAsserts.php | 2 +- tests/TestingTools/Asserts/EloquentAssertsTest.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e0d1f8d..982d5a7 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: diff --git a/src/Asserts/EloquentAsserts.php b/src/Asserts/EloquentAsserts.php index 0b21e48..5ed8d4f 100644 --- a/src/Asserts/EloquentAsserts.php +++ b/src/Asserts/EloquentAsserts.php @@ -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); diff --git a/tests/TestingTools/Asserts/EloquentAssertsTest.php b/tests/TestingTools/Asserts/EloquentAssertsTest.php index a6d1f6b..4c4ece5 100644 --- a/tests/TestingTools/Asserts/EloquentAssertsTest.php +++ b/tests/TestingTools/Asserts/EloquentAssertsTest.php @@ -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 */