diff --git a/src/Relations/AbstractRelation.php b/src/Relations/AbstractRelation.php index 54f9709..6e23714 100644 --- a/src/Relations/AbstractRelation.php +++ b/src/Relations/AbstractRelation.php @@ -86,7 +86,7 @@ abstract protected function createAssociation(ClassMetadataBuilder $builder, $re public function cascade(array $cascade) { foreach ($cascade as $name) { - $method = 'cascade'.(InflectorFactory::create()->build())->classify(strtolower($name)); + $method = 'cascade'.InflectorFactory::create()->build()->classify(strtolower($name)); if (!method_exists($this->association, $method)) { throw new InvalidArgumentException('Cascade ['.$name.'] does not exist'); @@ -105,7 +105,7 @@ public function cascade(array $cascade) */ public function fetch($strategy) { - $method = 'fetch'.(InflectorFactory::create()->build())->classify(strtolower($strategy)); + $method = 'fetch'.InflectorFactory::create()->build()->classify(strtolower($strategy)); if (!method_exists($this->association, $method)) { throw new InvalidArgumentException('Fetch ['.$strategy.'] does not exist'); diff --git a/tests/Builders/BuilderTest.php b/tests/Builders/BuilderTest.php index ffe7de4..74a34e7 100644 --- a/tests/Builders/BuilderTest.php +++ b/tests/Builders/BuilderTest.php @@ -41,7 +41,8 @@ class BuilderTest extends TestCase { - use IsMacroable, MockeryPHPUnitIntegration; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ClassMetadataBuilder @@ -549,8 +550,9 @@ public function test_has_one_implies_an_inverse_one_to_one() $result = $this->builder->getClassMetadata()->associationMappings['one']; - $this->assertFalse($result['isOwningSide'], - "HasOne relation is an inversed one-to-one, but resulted in the owning side." + $this->assertFalse( + $result['isOwningSide'], + 'HasOne relation is an inversed one-to-one, but resulted in the owning side.' ); } @@ -703,21 +705,21 @@ public function test_entity_listeners_can_be_configured_through_a_callable() [ 'class' => StubEntityListener::class, 'method' => 'swipeFloor', - ] + ], ], $this->fluent->getClassMetadata()->entityListeners['onFlush']); $this->assertEquals([ [ 'class' => StubEntityListener::class, 'method' => 'cleanToilet', - ] + ], ], $this->fluent->getClassMetadata()->entityListeners['postFlush']); $this->assertEquals([ [ 'class' => StubEntityListener::class, 'method' => 'onClear', - ] + ], ], $this->fluent->getClassMetadata()->entityListeners['onClear']); } @@ -745,8 +747,10 @@ public function test_can_override_many_to_one_association() $this->fluent->build(); - $this->assertEquals('target_id', - $this->fluent->getClassMetadata()->getAssociationMapping('manyToOne')['joinColumns'][0]['name']); + $this->assertEquals( + 'target_id', + $this->fluent->getClassMetadata()->getAssociationMapping('manyToOne')['joinColumns'][0]['name'] + ); $this->assertEquals('source_id', $this->fluent->getClassMetadata() ->getAssociationMapping('manyToOne')['joinColumns'][0]['referencedColumnName']); } @@ -761,8 +765,10 @@ public function test_can_override_many_to_many_association() $this->fluent->build(); - $this->assertEquals('custom_table_name', - $this->fluent->getClassMetadata()->getAssociationMapping('manyToMany')['joinTable']['name']); + $this->assertEquals( + 'custom_table_name', + $this->fluent->getClassMetadata()->getAssociationMapping('manyToMany')['joinTable']['name'] + ); $this->assertEquals('source_id', $this->fluent->getClassMetadata() ->getAssociationMapping('manyToMany')['joinTable']['joinColumns'][0]['name']); } @@ -778,7 +784,7 @@ public function test_can_guess_a_one_to_one_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity'); } catch (MappingException $e) { - $this->fail("Could not find default name for the oneToOne relation. " . $e->getMessage()); + $this->fail('Could not find default name for the oneToOne relation. '.$e->getMessage()); } } @@ -793,7 +799,7 @@ public function test_can_guess_a_has_one_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity'); } catch (MappingException $e) { - $this->fail("Could not find default name for the hasOne relation. " . $e->getMessage()); + $this->fail('Could not find default name for the hasOne relation. '.$e->getMessage()); } } @@ -808,7 +814,7 @@ public function test_can_guess_a_belongs_to_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity'); } catch (MappingException $e) { - $this->fail("Could not find default name for the belongsTo relation. " . $e->getMessage()); + $this->fail('Could not find default name for the belongsTo relation. '.$e->getMessage()); } } @@ -823,7 +829,7 @@ public function test_can_guess_a_one_to_many_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities'); } catch (MappingException $e) { - $this->fail("Could not find default name for the oneToMany relation. " . $e->getMessage()); + $this->fail('Could not find default name for the oneToMany relation. '.$e->getMessage()); } } @@ -838,7 +844,7 @@ public function test_can_guess_a_has_many_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities'); } catch (MappingException $e) { - $this->fail("Could not find default name for the hasMany relation. " . $e->getMessage()); + $this->fail('Could not find default name for the hasMany relation. '.$e->getMessage()); } } @@ -853,7 +859,7 @@ public function test_can_guess_a_many_to_many_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities'); } catch (MappingException $e) { - $this->fail("Could not find default name for the manyToMany relation. " . $e->getMessage()); + $this->fail('Could not find default name for the manyToMany relation. '.$e->getMessage()); } } @@ -868,7 +874,7 @@ public function test_can_guess_a_belongs_to_many_relation_name() try { $this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities'); } catch (MappingException $e) { - $this->fail("Could not find default name for the belongsToMany relation. " . $e->getMessage()); + $this->fail('Could not find default name for the belongsToMany relation. '.$e->getMessage()); } } @@ -909,5 +915,8 @@ protected function getMacroableBuilder() class FluentEntity { - protected $id, $name, $fluentEntity, $fluentEntities; + protected $id; + protected $name; + protected $fluentEntity; + protected $fluentEntities; } diff --git a/tests/Builders/EmbeddedTest.php b/tests/Builders/EmbeddedTest.php index a1bd1a1..48b51d5 100644 --- a/tests/Builders/EmbeddedTest.php +++ b/tests/Builders/EmbeddedTest.php @@ -28,7 +28,7 @@ protected function setUp(): void $this->embedded = new Embedded( $this->builder, - new DefaultNamingStrategy, + new DefaultNamingStrategy(), 'field', FluentEmbeddable::class ); diff --git a/tests/Builders/EntityListenersTest.php b/tests/Builders/EntityListenersTest.php index 8f3f4db..cf7dc7f 100644 --- a/tests/Builders/EntityListenersTest.php +++ b/tests/Builders/EntityListenersTest.php @@ -50,14 +50,15 @@ public function test_can_add_event_listeners($event, $listener, $expectedMethod, ); $this->assertCount( - 1, $this->fluent->getClassMetadata()->entityListeners[$event] + 1, + $this->fluent->getClassMetadata()->entityListeners[$event] ); $this->assertEquals([ [ 'class' => $listener, - 'method' => $expectedMethod - ] + 'method' => $expectedMethod, + ], ], $this->fluent->getClassMetadata()->entityListeners[$event]); } @@ -74,18 +75,19 @@ public function test_can_add_multiple_entity_listeners_per_event() ); $this->assertCount( - 2, $this->fluent->getClassMetadata()->entityListeners['onClear'] + 2, + $this->fluent->getClassMetadata()->entityListeners['onClear'] ); $this->assertEquals([ [ 'class' => StubEntityListener::class, - 'method' => 'onClear' + 'method' => 'onClear', ], [ 'class' => StubEntityListener::class, - 'method' => 'handle' - ] + 'method' => 'handle', + ], ], $this->fluent->getClassMetadata()->entityListeners['onClear']); } diff --git a/tests/Builders/EntityTest.php b/tests/Builders/EntityTest.php index 7a81db0..b490d14 100644 --- a/tests/Builders/EntityTest.php +++ b/tests/Builders/EntityTest.php @@ -12,7 +12,8 @@ class EntityTest extends TestCase { - use IsMacroable, MockeryPHPUnitIntegration; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ClassMetadataBuilder @@ -27,7 +28,7 @@ class EntityTest extends TestCase protected function setUp(): void { $this->builder = new ClassMetadataBuilder(new ClassMetadataInfo(StubEntity::class)); - $this->entity = new Entity($this->builder); + $this->entity = new Entity($this->builder); } public function test_can_set_repository_class() diff --git a/tests/Builders/FieldTest.php b/tests/Builders/FieldTest.php index 9a0ef4b..137ab8e 100644 --- a/tests/Builders/FieldTest.php +++ b/tests/Builders/FieldTest.php @@ -17,7 +17,8 @@ class FieldTest extends TestCase { - use IsMacroable, MockeryPHPUnitIntegration; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ClassMetadataBuilder @@ -160,8 +161,10 @@ public function test_can_set_default_fluently() $this->field->build(); - $this->assertEquals('default', - $this->builder->getClassMetadata()->getFieldMapping('name')['options']['default']); + $this->assertEquals( + 'default', + $this->builder->getClassMetadata()->getFieldMapping('name')['options']['default'] + ); } public function test_can_set_fixed() @@ -179,8 +182,10 @@ public function test_can_set_comment() $this->field->build(); - $this->assertEquals('comment', - $this->builder->getClassMetadata()->getFieldMapping('name')['options']['comment']); + $this->assertEquals( + 'comment', + $this->builder->getClassMetadata()->getFieldMapping('name')['options']['comment'] + ); } public function test_can_set_collation() @@ -189,8 +194,10 @@ public function test_can_set_collation() $this->field->build(); - $this->assertEquals('collation', - $this->builder->getClassMetadata()->getFieldMapping('name')['options']['collation']); + $this->assertEquals( + 'collation', + $this->builder->getClassMetadata()->getFieldMapping('name')['options']['collation'] + ); } public function test_can_make_field_primary() @@ -217,97 +224,97 @@ public function test_versioning_is_fluent() public function test_integer_can_be_used_for_versioning() { - $this->doTestValidTypeForVersioning("integer"); + $this->doTestValidTypeForVersioning('integer'); } public function test_bigint_can_be_used_for_versioning() { - $this->doTestValidTypeForVersioning("bigint"); + $this->doTestValidTypeForVersioning('bigint'); } public function test_smallint_can_be_used_for_versioning() { - $this->doTestValidTypeForVersioning("smallint"); + $this->doTestValidTypeForVersioning('smallint'); } public function test_datetime_can_be_used_for_versioning() { - $this->doTestValidTypeForVersioning("datetime"); + $this->doTestValidTypeForVersioning('datetime'); } public function test_array_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("array"); + $this->doTestInvalidTypeForVersioning('array'); } public function test_simple_array_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("simple_array"); + $this->doTestInvalidTypeForVersioning('simple_array'); } public function test_json_array_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("json"); + $this->doTestInvalidTypeForVersioning('json'); } public function test_boolean_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("boolean"); + $this->doTestInvalidTypeForVersioning('boolean'); } public function test_datetimetz_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("datetimetz"); + $this->doTestInvalidTypeForVersioning('datetimetz'); } public function test_date_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("date"); + $this->doTestInvalidTypeForVersioning('date'); } public function test_time_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("time"); + $this->doTestInvalidTypeForVersioning('time'); } public function test_decimal_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("decimal"); + $this->doTestInvalidTypeForVersioning('decimal'); } public function test_object_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("object"); + $this->doTestInvalidTypeForVersioning('object'); } public function test_string_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("string"); + $this->doTestInvalidTypeForVersioning('string'); } public function test_text_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("text"); + $this->doTestInvalidTypeForVersioning('text'); } public function test_binary_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("binary"); + $this->doTestInvalidTypeForVersioning('binary'); } public function test_blob_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("blob"); + $this->doTestInvalidTypeForVersioning('blob'); } public function test_float_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("float"); + $this->doTestInvalidTypeForVersioning('float'); } public function test_guid_cannot_be_used_for_versioning() { - $this->doTestInvalidTypeForVersioning("guid"); + $this->doTestInvalidTypeForVersioning('guid'); } public function test_ids_cannot_be_used_for_versioning() @@ -327,7 +334,7 @@ public function test_can_obtain_its_type_after_creation() public function test_buildable_objects_returned_from_macros_get_queued_and_built() { - Field::macro('foo', function(){ + Field::macro('foo', function () { /** @var Buildable|\Mockery\Mock $buildable */ $buildable = \Mockery::mock(Buildable::class); $buildable->shouldReceive('build')->once(); @@ -342,7 +349,7 @@ public function test_buildable_objects_returned_from_macros_get_queued_and_built private function doTestValidTypeForVersioning($type) { $builder = new ClassMetadataBuilder(new ClassMetadataInfo(StubEntity::class)); - $field = Field::make($builder, $type, "{$type}Field"); + $field = Field::make($builder, $type, "{$type}Field"); $field->useForVersioning()->build(); @@ -354,7 +361,7 @@ private function doTestValidTypeForVersioning($type) private function doTestInvalidTypeForVersioning($type) { $builder = new ClassMetadataBuilder(new ClassMetadataInfo(StubEntity::class)); - $field = Field::make($builder, $type, "aField"); + $field = Field::make($builder, $type, 'aField'); $this->expectException(MappingException::class); $field->useForVersioning()->build(); diff --git a/tests/Builders/GeneratedValueTest.php b/tests/Builders/GeneratedValueTest.php index f21d0bf..ab77e5a 100644 --- a/tests/Builders/GeneratedValueTest.php +++ b/tests/Builders/GeneratedValueTest.php @@ -27,7 +27,7 @@ class GeneratedValueTest extends TestCase protected function setUp(): void { $this->field = $this->getMockBuilder(FieldBuilder::class)->disableOriginalConstructor()->getMock(); - $this->cm = $this->getMockBuilder(ClassMetadataInfo::class)->disableOriginalConstructor()->getMock(); + $this->cm = $this->getMockBuilder(ClassMetadataInfo::class)->disableOriginalConstructor()->getMock(); $this->fluent = new GeneratedValue($this->field, $this->cm); } @@ -81,7 +81,9 @@ public function test_can_change_the_sequence_name_on_auto_strategy() { $this->field->expects($this->once())->method('generatedValue')->with('AUTO'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', $this->anything(), $this->anything() + 'crazy_name', + $this->anything(), + $this->anything() ); $this->fluent->auto('crazy_name')->build(); @@ -91,7 +93,9 @@ public function test_can_change_the_sequence_name_and_alloc_size_on_auto_strateg { $this->field->expects($this->once())->method('generatedValue')->with('AUTO'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', $this->anything(), 42 + 'crazy_name', + $this->anything(), + 42 ); $this->fluent @@ -103,7 +107,9 @@ public function test_can_change_the_sequence_name_and_initial_value_on_auto_stra { $this->field->expects($this->once())->method('generatedValue')->with('AUTO'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', 23, $this->anything() + 'crazy_name', + 23, + $this->anything() ); $this->fluent @@ -115,7 +121,9 @@ public function test_can_change_the_sequence_name_alloc_size_and_initial_value_o { $this->field->expects($this->once())->method('generatedValue')->with('AUTO'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', 23, 42 + 'crazy_name', + 23, + 42 ); $this->fluent @@ -137,7 +145,9 @@ public function test_can_change_the_sequence_name_on_sequence_strategy() { $this->field->expects($this->once())->method('generatedValue')->with('SEQUENCE'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', $this->anything(), $this->anything() + 'crazy_name', + $this->anything(), + $this->anything() ); $this->fluent->sequence('crazy_name')->build(); @@ -147,7 +157,9 @@ public function test_can_change_the_sequence_name_and_alloc_size_on_sequence_str { $this->field->expects($this->once())->method('generatedValue')->with('SEQUENCE'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', $this->anything(), 42 + 'crazy_name', + $this->anything(), + 42 ); $this->fluent @@ -159,7 +171,9 @@ public function test_can_change_the_sequence_name_and_initial_value_on_sequence_ { $this->field->expects($this->once())->method('generatedValue')->with('SEQUENCE'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', 23, $this->anything() + 'crazy_name', + 23, + $this->anything() ); $this->fluent @@ -171,7 +185,9 @@ public function test_can_change_the_sequence_name_alloc_size_and_initial_value_o { $this->field->expects($this->once())->method('generatedValue')->with('SEQUENCE'); $this->field->expects($this->once())->method('setSequenceGenerator')->with( - 'crazy_name', 23, 42 + 'crazy_name', + 23, + 42 ); $this->fluent diff --git a/tests/Builders/Inheritance/InheritanceTestCase.php b/tests/Builders/Inheritance/InheritanceTestCase.php index c8927fd..b169f93 100644 --- a/tests/Builders/Inheritance/InheritanceTestCase.php +++ b/tests/Builders/Inheritance/InheritanceTestCase.php @@ -70,7 +70,7 @@ public function test_can_set_map_as_array() $this->inheritance->map([ 'stub1' => StubEntity::class, 'stub2' => StubEntity2::class, - 'stub3' => StubEntity3::class + 'stub3' => StubEntity3::class, ]); $map = $this->builder->getClassMetadata()->discriminatorMap; diff --git a/tests/Builders/IsMacroable.php b/tests/Builders/IsMacroable.php index ae4df93..ae0fea4 100644 --- a/tests/Builders/IsMacroable.php +++ b/tests/Builders/IsMacroable.php @@ -1,4 +1,5 @@ getMacroableBuilder(); @@ -37,20 +39,19 @@ public function test_can_only_be_extended_with_closures() $this->expectExceptionMessage('Macros should be used with a closure argument, none given'); call_user_func( - [get_class($this->getMacroableBuilder()), 'macro'], + [get_class($this->getMacroableBuilder()), 'macro'], 'fail' ); - } public function test_two_different_instances_contain_all_macros() { $builder = $this->getMacroableBuilder(); $other = clone $builder; - + $this->addMacroCallExpectation($builder, [], 'addedOnBuilder'); $this->addMacroCallExpectation($other, [], 'addedOnOther'); - + $builder->addedOnOther(); $other->addedOnBuilder(); } @@ -65,11 +66,11 @@ public function test_two_different_instances_contain_all_macros() private function addMacroCallExpectation($builder, array $params = [], $method = 'callTheMock') { array_unshift($params, \Mockery::type(get_class($builder))); - + /** @var \Mockery\Mock $mock */ $mock = \Mockery::mock(['callMe' => true]); $mock->shouldReceive('callMe')->once()->withArgs($params); - + call_user_func( [get_class($builder), 'macro'], $method, @@ -77,7 +78,7 @@ function () use ($mock) { call_user_func_array([$mock, 'callMe'], func_get_args()); } ); - + return $mock; } } diff --git a/tests/Builders/LifecycleEventsTest.php b/tests/Builders/LifecycleEventsTest.php index c16ba16..28220ba 100644 --- a/tests/Builders/LifecycleEventsTest.php +++ b/tests/Builders/LifecycleEventsTest.php @@ -84,7 +84,7 @@ private function doEventTest($event) "Event [$event] is already associated!" ); - for ($i = 0, $max = mt_rand(1, 5); $i < $max; ++$i) { + for ($i = 0, $max = mt_rand(1, 5); $i < $max; $i++) { $this->builder->$event(uniqid()); } @@ -96,8 +96,9 @@ private function doEventTest($event) ); $this->assertCount( - $max, $actual = $this->fluent->getClassMetadata()->getLifecycleCallbacks($event), - "Expected [$max] events associated for [$event], got " . count($actual) + $max, + $actual = $this->fluent->getClassMetadata()->getLifecycleCallbacks($event), + "Expected [$max] events associated for [$event], got ".count($actual) ); } } diff --git a/tests/Builders/Overrides/AttributeOverrideTest.php b/tests/Builders/Overrides/AttributeOverrideTest.php index f2d65c2..d443f66 100644 --- a/tests/Builders/Overrides/AttributeOverrideTest.php +++ b/tests/Builders/Overrides/AttributeOverrideTest.php @@ -64,7 +64,7 @@ public function test_can_override_column_name() public function test_default_settings_should_be_kept() { $this->builder->addField('nullable_attribute', 'string', [ - 'nullable' => true + 'nullable' => true, ]); $override = $this->override('nullable_attribute', function ($field) { @@ -80,7 +80,7 @@ public function test_default_settings_should_be_kept() public function test_can_override_settings() { $this->builder->addField('nullable_attribute', 'string', [ - 'nullable' => true + 'nullable' => true, ]); $override = $this->override('nullable_attribute', function ($field) { @@ -97,8 +97,8 @@ public function test_adding_new_options_will_merge_them() { $this->builder->addField('nullable_attribute', 'string', [ 'options' => [ - 'default' => 'some_default' - ] + 'default' => 'some_default', + ], ]); $override = $this->override('nullable_attribute', function ($field) { diff --git a/tests/Builders/TableTest.php b/tests/Builders/TableTest.php index bf5a44c..ee98761 100644 --- a/tests/Builders/TableTest.php +++ b/tests/Builders/TableTest.php @@ -23,25 +23,25 @@ class TableTest extends TestCase protected function setUp(): void { $this->builder = new ClassMetadataBuilder(new ClassMetadataInfo(StubEntity::class)); - $this->table = new Table($this->builder); + $this->table = new Table($this->builder); } public function test_can_be_constructed_with_a_name_string() { - new Table($this->builder, 'users'); + new Table($this->builder, 'users'); $this->assertEquals('users', $this->builder->getClassMetadata()->getTableName()); } public function test_it_ignores_empty_names() { - $this->assertNull($this->builder->getClassMetadata()->table); + $this->assertNull($this->builder->getClassMetadata()->table); } public function test_it_can_be_constructed_with_a_callback_instead_of_a_name() { - new Table($this->builder, function(Table $builder){ - $builder->setName('crazy_logic'); + new Table($this->builder, function (Table $builder) { + $builder->setName('crazy_logic'); }); $this->assertEquals('crazy_logic', $this->builder->getClassMetadata()->getTableName()); @@ -74,18 +74,19 @@ public function test_can_set_options() { $this->table->options([ 'collate' => 'utf8mb4_unicode_ci', - 'charset' => 'utf8mb4' + 'charset' => 'utf8mb4', ]); $this->table->build(); $this->assertEquals([ 'collate' => 'utf8mb4_unicode_ci', - 'charset' => 'utf8mb4' + 'charset' => 'utf8mb4', ], $this->builder->getClassMetadata()->table['options']); } - public function test_set_options_does_not_touch_other_data() { + public function test_set_options_does_not_touch_other_data() + { $table = $this->table->getClassMetadata()->table; $this->table->options(['collate' => 'utf8mb4_unicode_ci']); @@ -96,7 +97,8 @@ public function test_set_options_does_not_touch_other_data() { $this->assertEquals($table, $this->builder->getClassMetadata()->table); } - public function test_can_set_options_and_change_schema () { + public function test_can_set_options_and_change_schema() + { $this->table->options(['collate' => 'utf8mb4_unicode_ci']); $this->table->schema('a_schema'); @@ -106,7 +108,8 @@ public function test_can_set_options_and_change_schema () { $this->assertEquals(['collate' => 'utf8mb4_unicode_ci'], $this->builder->getClassMetadata()->table['options']); } - public function test_can_set_charset() { + public function test_can_set_charset() + { $this->table->charset('utf8mb4'); $this->table->build(); @@ -114,7 +117,8 @@ public function test_can_set_charset() { $this->assertEquals('utf8mb4', $this->builder->getClassMetadata()->table['options']['charset']); } - public function test_can_set_collate() { + public function test_can_set_collate() + { $this->table->collate('utf8mb4_unicode_ci'); $this->table->build(); @@ -122,7 +126,8 @@ public function test_can_set_collate() { $this->assertEquals('utf8mb4_unicode_ci', $this->builder->getClassMetadata()->table['options']['collate']); } - public function test_can_chain_collate_charset_schema() { + public function test_can_chain_collate_charset_schema() + { $this->table->collate('utf8mb4_unicode_ci')->charset('utf8mb4')->schema('a_schema'); $this->table->build(); @@ -130,7 +135,7 @@ public function test_can_chain_collate_charset_schema() { $this->assertEquals('a_schema', $this->builder->getClassMetadata()->table['schema']); $this->assertEquals([ 'collate' => 'utf8mb4_unicode_ci', - 'charset' => 'utf8mb4' + 'charset' => 'utf8mb4', ], $this->builder->getClassMetadata()->table['options']); } } diff --git a/tests/Builders/Traits/QueueableTest.php b/tests/Builders/Traits/QueueableTest.php index 174dc52..6c417a5 100644 --- a/tests/Builders/Traits/QueueableTest.php +++ b/tests/Builders/Traits/QueueableTest.php @@ -80,11 +80,11 @@ public function test_macro_inception_doesnt_get_the_buildable_built_twice() $mock = \Mockery::mock(Buildable::class); $mock->shouldReceive('build')->once(); - QueueableClass::macro('firstLevel', function() use ($mock) { + QueueableClass::macro('firstLevel', function () use ($mock) { return $mock; }); - QueueableClass::macro('inception', function(QueueableClass $builder){ + QueueableClass::macro('inception', function (QueueableClass $builder) { return $builder->firstLevel(); }); @@ -95,7 +95,9 @@ public function test_macro_inception_doesnt_get_the_buildable_built_twice() class QueueableClass { - use Queueable, Macroable, QueuesMacros; + use Queueable; + use Macroable; + use QueuesMacros; public function addToQueue(Buildable $buildable) { diff --git a/tests/Extensions/ExtensibleClassMetadataFactoryFactoryTest.php b/tests/Extensions/ExtensibleClassMetadataFactoryFactoryTest.php index 1b88c9f..7df215f 100644 --- a/tests/Extensions/ExtensibleClassMetadataFactoryFactoryTest.php +++ b/tests/Extensions/ExtensibleClassMetadataFactoryFactoryTest.php @@ -1,4 +1,5 @@ shouldReceive('getConfiguration')->once()->andReturn($config); $config->shouldReceive('getNamingStrategy')->once()->andReturn($namingStrategy); $factory = new ExtensionFactoryTest(); $factory->setEntityManager($em); - + $this->assertInstanceOf(ExtensibleClassMetadata::class, $factory->getClassMetadataInstance()); } } -class ExtensionFactoryTest extends ExtensibleClassMetadataFactory { +class ExtensionFactoryTest extends ExtensibleClassMetadataFactory +{ /** * This is the only sane way of testing the small part of what we do in this factory. * Every other test would require infinite mocking. - * + * * @return ExtensibleClassMetadata */ public function getClassMetadataInstance() { - return $this->newClassMetadataInstance("Foo"); + return $this->newClassMetadataInstance('Foo'); } } diff --git a/tests/Extensions/ExtensibleClassMetadataTest.php b/tests/Extensions/ExtensibleClassMetadataTest.php index 8825a17..f9b793c 100644 --- a/tests/Extensions/ExtensibleClassMetadataTest.php +++ b/tests/Extensions/ExtensibleClassMetadataTest.php @@ -1,8 +1,9 @@ cm = new ExtensibleClassMetadata("Foo"); + $this->cm = new ExtensibleClassMetadata('Foo'); } public function test_it_should_be_a_doctrine_class_metadata() @@ -26,8 +27,8 @@ public function test_it_should_be_a_doctrine_class_metadata() public function test_it_should_hold_extension_information() { - $this->cm->addExtension('foo', [ - 'bar' => 'baz' + $this->cm->addExtension('foo', [ + 'bar' => 'baz', ]); $this->assertNotEmpty($this->cm->extensions); @@ -36,14 +37,14 @@ public function test_it_should_hold_extension_information() public function test_it_can_merge_and_overwrite_existing_extension() { - $this->cm->addExtension('foo', [ + $this->cm->addExtension('foo', [ 'foo' => 'foo', 'bar' => 'bar', ]); $this->cm->mergeExtension('foo', [ 'bar' => 'baz', - 'baz' => 'baz' + 'baz' => 'baz', ]); $this->assertEquals([ @@ -55,14 +56,14 @@ public function test_it_can_merge_and_overwrite_existing_extension() public function test_it_can_merge_and_append_to_existing_extension() { - $this->cm->addExtension('foo', [ + $this->cm->addExtension('foo', [ 'foo' => 'foo', 'bar' => 'bar', ]); $this->cm->appendExtension('foo', [ 'bar' => 'baz', - 'baz' => 'baz' + 'baz' => 'baz', ]); $this->assertEquals([ diff --git a/tests/Extensions/Gedmo/BlameableTest.php b/tests/Extensions/Gedmo/BlameableTest.php index d1e1a50..3bd8306 100644 --- a/tests/Extensions/Gedmo/BlameableTest.php +++ b/tests/Extensions/Gedmo/BlameableTest.php @@ -1,4 +1,5 @@ classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new Blameable($this->classMetadata, $this->fieldName); + $this->extension = new Blameable($this->classMetadata, $this->fieldName); } - + public function test_it_should_add_itself_as_a_field_macro() { - Blameable::enable(); - + Blameable::enable(); + $field = Field::make(new ClassMetadataBuilder(new ExtensibleClassMetadata('Foo')), 'string', $this->fieldName); - + $this->assertInstanceOf( - Blameable::class, + Blameable::class, call_user_func([$field, Blameable::MACRO_METHOD]) ); } - + public function test_it_should_add_itself_as_a_many_to_one_macro() { - Blameable::enable(); - + Blameable::enable(); + $manyToOne = new ManyToOne( new ClassMetadataBuilder(new ExtensibleClassMetadata('Foo')), new DefaultNamingStrategy(), $this->fieldName, 'Bar' ); - + $this->assertInstanceOf( - Blameable::class, + Blameable::class, call_user_func([$manyToOne, Blameable::MACRO_METHOD]) ); } - + /** * @return AbstractTrackingExtension */ diff --git a/tests/Extensions/Gedmo/ClosureTableTest.php b/tests/Extensions/Gedmo/ClosureTableTest.php index 6ab94f8..9a2629f 100644 --- a/tests/Extensions/Gedmo/ClosureTableTest.php +++ b/tests/Extensions/Gedmo/ClosureTableTest.php @@ -37,7 +37,7 @@ public function test_it_gets_along_well_with_the_field_builder_macros() { Tree::enable(); - $this->builder->tree()->asClosureTable('Bar'); + $this->builder->tree()->asClosureTable('Bar'); $this->builder->belongsTo('Foo', 'parent')->treeParent(); $this->builder->integer('lvl')->treeLevel(); @@ -54,7 +54,7 @@ public function test_it_gets_along_well_with_the_field_builder_macros() public function test_it_adds_the_closure_table_repository_as_default() { - $this->builder->tree()->asClosureTable('Bar'); + $this->builder->tree()->asClosureTable('Bar'); $this->builder->build(); $this->assertEquals( diff --git a/tests/Extensions/Gedmo/IpTraceableTest.php b/tests/Extensions/Gedmo/IpTraceableTest.php index e7c652a..4153976 100644 --- a/tests/Extensions/Gedmo/IpTraceableTest.php +++ b/tests/Extensions/Gedmo/IpTraceableTest.php @@ -1,4 +1,5 @@ fieldName = 'ip'; + $this->fieldName = 'ip'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new IpTraceable($this->classMetadata, $this->fieldName); + $this->extension = new IpTraceable($this->classMetadata, $this->fieldName); } - + public function test_it_should_add_itself_as_a_field_macro() { IpTraceable::enable(); @@ -36,7 +37,6 @@ public function test_it_should_add_itself_as_a_field_macro() call_user_func([$field, IpTraceable::MACRO_METHOD]) ); } - /** * @return AbstractTrackingExtension diff --git a/tests/Extensions/Gedmo/LocaleTest.php b/tests/Extensions/Gedmo/LocaleTest.php index 95a012f..2b93340 100644 --- a/tests/Extensions/Gedmo/LocaleTest.php +++ b/tests/Extensions/Gedmo/LocaleTest.php @@ -39,9 +39,9 @@ protected function setUp(): void { Locale::enable(); - $this->fieldName = 'locale'; + $this->fieldName = 'locale'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); + $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); $this->extension = new Locale($this->classMetadata, $this->fieldName); } @@ -81,14 +81,14 @@ public function test_it_should_fail_when_trying_to_use_a_mapped_field_as_locale_ $this->builder->build(); } - /** * Assert that the resulting build matches exactly with the given array. * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/LoggableTest.php b/tests/Extensions/Gedmo/LoggableTest.php index 5933706..285f8bf 100644 --- a/tests/Extensions/Gedmo/LoggableTest.php +++ b/tests/Extensions/Gedmo/LoggableTest.php @@ -28,7 +28,7 @@ class LoggableTest extends TestCase protected function setUp(): void { $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->loggable = new Loggable($this->classMetadata); + $this->loggable = new Loggable($this->classMetadata); } public function test_it_should_mark_the_entity_as_loggable() @@ -68,12 +68,12 @@ public function test_it_respects_previous_configurations() public function test_it_should_add_itself_as_a_builder_macro() { - Loggable::enable(); - + Loggable::enable(); + $entity = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); - + $entity->loggable(); - + $this->assertNotNull($this->classMetadata->getExtension(Fluent::EXTENSION_NAME)); } @@ -100,7 +100,6 @@ public function test_it_should_add_versioned_as_a_many_to_one_macro() 'SomeEntity' ); - $relation->versioned(); $relation->build(); @@ -118,7 +117,6 @@ public function test_it_should_add_versioned_as_a_one_to_one_macro() 'SomeEntity' ); - $relation->versioned(); $relation->build(); diff --git a/tests/Extensions/Gedmo/Mappings/Loggable/LogEntryMappingTest.php b/tests/Extensions/Gedmo/Mappings/Loggable/LogEntryMappingTest.php index 94ba123..909a931 100644 --- a/tests/Extensions/Gedmo/Mappings/Loggable/LogEntryMappingTest.php +++ b/tests/Extensions/Gedmo/Mappings/Loggable/LogEntryMappingTest.php @@ -16,19 +16,19 @@ public function configureMocks() /** @var \Mockery\Mock|Entity $entity */ $entity = \Mockery::mock(Entity::class); $entity->shouldReceive('setRepositoryClass')->with(LogEntryRepository::class)->andReturnSelf(); - + /** @var Index|\Mockery\Mock $index */ $index = \Mockery::mock(Index::class); - $index->shouldReceive('name')->with("log_class_lookup_idx")->once()->andReturnSelf(); - $index->shouldReceive('name')->with("log_date_lookup_idx")->once()->andReturnSelf(); - $index->shouldReceive('name')->with("log_user_lookup_idx")->once()->andReturnSelf(); - $index->shouldReceive('name')->with("log_version_lookup_idx")->once()->andReturnSelf(); - + $index->shouldReceive('name')->with('log_class_lookup_idx')->once()->andReturnSelf(); + $index->shouldReceive('name')->with('log_date_lookup_idx')->once()->andReturnSelf(); + $index->shouldReceive('name')->with('log_user_lookup_idx')->once()->andReturnSelf(); + $index->shouldReceive('name')->with('log_version_lookup_idx')->once()->andReturnSelf(); + $this->builder->shouldReceive('table')->with('ext_log_entries')->andReturnSelf(); - $this->builder->shouldReceive('index')->with(["object_class"])->andReturn($index); - $this->builder->shouldReceive('index')->with(["logged_at"])->andReturn($index); - $this->builder->shouldReceive('index')->with(["username"])->andReturn($index); - $this->builder->shouldReceive('index')->with(["object_id", "object_class", "version"])->andReturn($index); + $this->builder->shouldReceive('index')->with(['object_class'])->andReturn($index); + $this->builder->shouldReceive('index')->with(['logged_at'])->andReturn($index); + $this->builder->shouldReceive('index')->with(['username'])->andReturn($index); + $this->builder->shouldReceive('index')->with(['object_id', 'object_class', 'version'])->andReturn($index); $this->builder->shouldReceive('entity')->andReturn($entity); } diff --git a/tests/Extensions/Gedmo/Mappings/MappingTestCase.php b/tests/Extensions/Gedmo/Mappings/MappingTestCase.php index 651e9ff..022ca2e 100644 --- a/tests/Extensions/Gedmo/Mappings/MappingTestCase.php +++ b/tests/Extensions/Gedmo/Mappings/MappingTestCase.php @@ -37,6 +37,7 @@ abstract protected function getMappingClass(); /** * Get the class name of the mapped class. + * * @return string */ abstract protected function getMappedClass(); @@ -52,7 +53,7 @@ abstract protected function configureMocks(); protected function setUp(): void { $class = $this->getMappingClass(); - $this->mapping = new $class; + $this->mapping = new $class(); $this->builder = \Mockery::mock(Fluent::class); $this->field = \Mockery::mock(Field::class); @@ -79,7 +80,7 @@ public function test_it_maps_the_mapped_class() */ protected function generatedValueExpectation($strategy = 'identity') { - return \Mockery::on(function($argument) use ($strategy) { + return \Mockery::on(function ($argument) use ($strategy) { /** @var GeneratedValue|\Mockery\Mock $gen */ $gen = \Mockery::mock(GeneratedValue::class); $gen->shouldReceive($strategy)->once(); @@ -89,6 +90,7 @@ protected function generatedValueExpectation($strategy = 'identity') } $argument($gen); + return true; }); } diff --git a/tests/Extensions/Gedmo/Mappings/Translatable/TranslationMappingTest.php b/tests/Extensions/Gedmo/Mappings/Translatable/TranslationMappingTest.php index 041e438..63b83d7 100644 --- a/tests/Extensions/Gedmo/Mappings/Translatable/TranslationMappingTest.php +++ b/tests/Extensions/Gedmo/Mappings/Translatable/TranslationMappingTest.php @@ -27,18 +27,18 @@ protected function configureMocks() /** @var Entity|\Mockery\Mock $entity */ $entity = \Mockery::mock(Entity::class); $entity->shouldReceive('setRepositoryClass')->with(TranslationRepository::class)->once()->andReturnSelf(); - + /** @var Index|\Mockery\Mock $index */ $index = \Mockery::mock(Index::class); $index->shouldReceive('name')->with('translations_lookup_idx')->once()->andReturnSelf(); - + /** @var UniqueConstraint|\Mockery\Mock $unique */ $unique = \Mockery::mock(UniqueConstraint::class); $unique->shouldReceive('name')->with('lookup_unique_idx')->once()->andReturnSelf(); - + $this->builder->shouldReceive('table')->with('ext_translations')->once()->andReturnSelf(); $this->builder->shouldReceive('entity')->once()->andReturn($entity); - $this->builder->shouldReceive('index')->with(["locale", "object_class", "foreign_key"])->once()->andReturn($index); - $this->builder->shouldReceive('unique')->with(["locale", "object_class", "field", "foreign_key"])->once()->andReturn($unique); + $this->builder->shouldReceive('index')->with(['locale', 'object_class', 'foreign_key'])->once()->andReturn($index); + $this->builder->shouldReceive('unique')->with(['locale', 'object_class', 'field', 'foreign_key'])->once()->andReturn($unique); } } diff --git a/tests/Extensions/Gedmo/MaterializedPathTest.php b/tests/Extensions/Gedmo/MaterializedPathTest.php index c73e793..6d8b9a1 100644 --- a/tests/Extensions/Gedmo/MaterializedPathTest.php +++ b/tests/Extensions/Gedmo/MaterializedPathTest.php @@ -33,13 +33,14 @@ class MaterializedPathTest extends TestCase protected function setUp(): void { - $this->classMetadata = new ExtensibleClassMetadata("Foo"); - $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); - $this->tree = new MaterializedPath($this->builder); + $this->classMetadata = new ExtensibleClassMetadata('Foo'); + $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); + $this->tree = new MaterializedPath($this->builder); } /** * @runInSeparateProcess + * * @preserveGlobalState false */ public function test_it_should_enable_field_macros() @@ -61,11 +62,12 @@ public function test_it_should_enable_field_macros() /** * @runInSeparateProcess + * * @preserveGlobalState false */ public function test_it_gets_along_with_other_tree_field_builders() { - Tree::enable(); + Tree::enable(); $this->builder->tree()->asMaterializedPath(); @@ -95,7 +97,6 @@ public function test_it_gets_along_with_other_tree_field_builders() ]); } - public function test_it_lets_me_customize_the_path_field() { $this->tree->path('thePath')->build(); @@ -158,14 +159,14 @@ public function test_has_defaults_for_everything() public function test_it_returns_a_false_value_for_activate_locking_as_its_not_supported() { - $this->tree->build(); + $this->tree->build(); $this->assertExtensionKeyEquals('activate_locking', false); } public function test_the_path_is_forced_to_nullable() { - $this->tree->path('someField')->build(); + $this->tree->path('someField')->build(); $this->builder->build(); $this->assertTrue($this->classMetadata->fieldMappings['someField']['nullable']); @@ -176,8 +177,9 @@ public function test_the_path_is_forced_to_nullable() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertExtensionEquals(array $expected) { @@ -190,8 +192,9 @@ protected function assertExtensionEquals(array $expected) * @param string $key * @param mixed $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertExtensionKeyEquals($key, $expected) { diff --git a/tests/Extensions/Gedmo/NestedSetTest.php b/tests/Extensions/Gedmo/NestedSetTest.php index 439a620..4306574 100644 --- a/tests/Extensions/Gedmo/NestedSetTest.php +++ b/tests/Extensions/Gedmo/NestedSetTest.php @@ -23,6 +23,7 @@ class NestedSetTest extends TreeStrategyTest /** * @runInSeparateProcess + * * @preserveGlobalState false */ public function test_building_a_nested_tree_through_the_tree_facade() diff --git a/tests/Extensions/Gedmo/SluggableTest.php b/tests/Extensions/Gedmo/SluggableTest.php index 49c5c42..2ad98b1 100644 --- a/tests/Extensions/Gedmo/SluggableTest.php +++ b/tests/Extensions/Gedmo/SluggableTest.php @@ -1,4 +1,5 @@ classMetadataBuilder); @@ -89,7 +90,7 @@ public function test_it_queues_when_used_as_field_macro_so_that_the_field_gets_b 'unique_base' => null, 'separator' => '-', 'prefix' => '', - 'suffix' => '' + 'suffix' => '', ]); } @@ -109,7 +110,7 @@ public function test_it_should_add_sluggable_to_the_given_field() 'unique_base' => null, 'separator' => '-', 'prefix' => '', - 'suffix' => '' + 'suffix' => '', ]); } @@ -141,7 +142,7 @@ public function test_can_set_custom_settingss() 'unique_base' => 'base', 'separator' => '_', 'prefix' => 'prefix-', - 'suffix' => '-suffix' + 'suffix' => '-suffix', ]); } @@ -163,15 +164,16 @@ public function can_have_many_sluggable_fields() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { $this->assertEquals([ 'slugs' => [ - $this->fieldName => $expected - ] + $this->fieldName => $expected, + ], ], $this->classMetadata->getExtension( $this->getExtensionName() )); diff --git a/tests/Extensions/Gedmo/SoftDeleteableTest.php b/tests/Extensions/Gedmo/SoftDeleteableTest.php index e1c1bf8..2d6955c 100644 --- a/tests/Extensions/Gedmo/SoftDeleteableTest.php +++ b/tests/Extensions/Gedmo/SoftDeleteableTest.php @@ -1,4 +1,5 @@ fieldName = 'deletedAt'; + $this->fieldName = 'deletedAt'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new SoftDeleteable($this->classMetadata, $this->fieldName); + $this->extension = new SoftDeleteable($this->classMetadata, $this->fieldName); } public function test_it_should_add_itself_as_a_field_macro() @@ -67,7 +68,7 @@ public function test_it_should_add_softdelete_to_the_given_field() $this->assertBuildResultIs([ 'softDeleteable' => true, 'fieldName' => $this->fieldName, - 'timeAware' => false + 'timeAware' => false, ]); } @@ -78,7 +79,7 @@ public function test_it_should_allow_to_be_time_aware() $this->assertBuildResultIs([ 'softDeleteable' => true, 'fieldName' => $this->fieldName, - 'timeAware' => true + 'timeAware' => true, ]); } @@ -87,8 +88,9 @@ public function test_it_should_allow_to_be_time_aware() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/SortableGroupTest.php b/tests/Extensions/Gedmo/SortableGroupTest.php index 420785a..216c0d1 100644 --- a/tests/Extensions/Gedmo/SortableGroupTest.php +++ b/tests/Extensions/Gedmo/SortableGroupTest.php @@ -31,9 +31,9 @@ class SortableGroupTest extends TestCase protected function setUp(): void { - $this->fieldName = 'category'; + $this->fieldName = 'category'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new SortableGroup($this->classMetadata, $this->fieldName, 'name'); + $this->extension = new SortableGroup($this->classMetadata, $this->fieldName, 'name'); } public function test_it_should_add_itself_as_a_field_macro() @@ -98,8 +98,9 @@ public function test_it_should_add_sortable_to_the_given_group() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/SortablePositionTest.php b/tests/Extensions/Gedmo/SortablePositionTest.php index 3141cf0..171d71f 100644 --- a/tests/Extensions/Gedmo/SortablePositionTest.php +++ b/tests/Extensions/Gedmo/SortablePositionTest.php @@ -28,9 +28,9 @@ class SortablePositionTest extends TestCase protected function setUp(): void { - $this->fieldName = 'position'; + $this->fieldName = 'position'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new SortablePosition($this->classMetadata, $this->fieldName, 'name'); + $this->extension = new SortablePosition($this->classMetadata, $this->fieldName, 'name'); } public function test_it_should_add_itself_as_a_field_macro() @@ -61,8 +61,9 @@ public function test_it_should_add_sortable_to_the_given_field() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TimestampableTest.php b/tests/Extensions/Gedmo/TimestampableTest.php index 6625e36..2588de5 100644 --- a/tests/Extensions/Gedmo/TimestampableTest.php +++ b/tests/Extensions/Gedmo/TimestampableTest.php @@ -1,4 +1,5 @@ fieldName = 'ip'; + $this->fieldName = 'ip'; $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->extension = new Timestampable($this->classMetadata, $this->fieldName); + $this->extension = new Timestampable($this->classMetadata, $this->fieldName); } - + public function test_it_should_add_itself_as_a_field_macro() { Timestampable::enable(); diff --git a/tests/Extensions/Gedmo/TrackingExtensions.php b/tests/Extensions/Gedmo/TrackingExtensions.php index 0e1977e..2c106cd 100644 --- a/tests/Extensions/Gedmo/TrackingExtensions.php +++ b/tests/Extensions/Gedmo/TrackingExtensions.php @@ -1,4 +1,5 @@ expectException(InvalidMappingException::class); @@ -132,8 +132,9 @@ public function test_it_should_not_allow_tracking_an_array_of_fields_with_a_spec * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TranslatableTest.php b/tests/Extensions/Gedmo/TranslatableTest.php index d5c3e6f..ab17957 100644 --- a/tests/Extensions/Gedmo/TranslatableTest.php +++ b/tests/Extensions/Gedmo/TranslatableTest.php @@ -1,4 +1,5 @@ fieldName = 'title'; + $this->fieldName = 'title'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'string', 'title')->build(); @@ -41,8 +42,11 @@ public function test_it_should_add_itself_as_a_field_macro() { Translatable::enable(); - $field = Field::make(new ClassMetadataBuilder(new ExtensibleClassMetadata('Foo')), 'string', - $this->fieldName)->build(); + $field = Field::make( + new ClassMetadataBuilder(new ExtensibleClassMetadata('Foo')), + 'string', + $this->fieldName + )->build(); $this->assertInstanceOf( Translatable::class, @@ -77,8 +81,9 @@ public function can_have_many_translatable_fields() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TranslationClassTest.php b/tests/Extensions/Gedmo/TranslationClassTest.php index 678da89..1f0779c 100644 --- a/tests/Extensions/Gedmo/TranslationClassTest.php +++ b/tests/Extensions/Gedmo/TranslationClassTest.php @@ -33,7 +33,7 @@ class TranslationClassTest extends TestCase protected function setUp(): void { - $this->className = 'TranslationClass'; + $this->className = 'TranslationClass'; $this->classMetadata = new ExtensibleClassMetadata('foo'); $this->extension = new TranslationClass($this->classMetadata, $this->className); } @@ -64,8 +64,9 @@ public function test_can_mark_a_field_as_locale() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreeLeftTest.php b/tests/Extensions/Gedmo/TreeLeftTest.php index 36904f9..a403834 100644 --- a/tests/Extensions/Gedmo/TreeLeftTest.php +++ b/tests/Extensions/Gedmo/TreeLeftTest.php @@ -32,7 +32,7 @@ class TreeLeftTest extends TestCase protected function setUp(): void { - $this->fieldName = 'lft'; + $this->fieldName = 'lft'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -43,8 +43,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreeLeft::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -79,8 +83,9 @@ public function test_left_should_be_integer() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreeLevelTest.php b/tests/Extensions/Gedmo/TreeLevelTest.php index 95cf1c1..43bb900 100644 --- a/tests/Extensions/Gedmo/TreeLevelTest.php +++ b/tests/Extensions/Gedmo/TreeLevelTest.php @@ -32,7 +32,7 @@ class TreeLevelTest extends TestCase protected function setUp(): void { - $this->fieldName = 'lvl'; + $this->fieldName = 'lvl'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -43,8 +43,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreeLevel::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -79,8 +83,9 @@ public function test_level_should_be_integer() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreePathHashTest.php b/tests/Extensions/Gedmo/TreePathHashTest.php index eee9c50..7a708c6 100644 --- a/tests/Extensions/Gedmo/TreePathHashTest.php +++ b/tests/Extensions/Gedmo/TreePathHashTest.php @@ -31,7 +31,7 @@ class TreePathHashTest extends TestCase protected function setUp(): void { - $this->fieldName = 'hash'; + $this->fieldName = 'hash'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -42,8 +42,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreePathHash::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -66,8 +70,9 @@ public function test_can_mark_a_field_as_hash() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreePathSourceTest.php b/tests/Extensions/Gedmo/TreePathSourceTest.php index 98540ea..a46931d 100644 --- a/tests/Extensions/Gedmo/TreePathSourceTest.php +++ b/tests/Extensions/Gedmo/TreePathSourceTest.php @@ -32,7 +32,7 @@ class TreePathSourceTest extends TestCase protected function setUp(): void { - $this->fieldName = 'source'; + $this->fieldName = 'source'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -43,8 +43,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreePathSource::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -79,8 +83,9 @@ public function test_can_mark_a_field_as_source() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreePathTest.php b/tests/Extensions/Gedmo/TreePathTest.php index f6fea6a..43cdaa1 100644 --- a/tests/Extensions/Gedmo/TreePathTest.php +++ b/tests/Extensions/Gedmo/TreePathTest.php @@ -32,7 +32,7 @@ class TreePathTest extends TestCase protected function setUp(): void { - $this->fieldName = 'path'; + $this->fieldName = 'path'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -43,8 +43,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreePath::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -92,7 +96,6 @@ public function test_separator_should_given() $this->getExtension() ->separator('|||') ->build(); - } /** @@ -100,8 +103,9 @@ public function test_separator_should_given() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreeRightTest.php b/tests/Extensions/Gedmo/TreeRightTest.php index 1c283c2..e6ffcf8 100644 --- a/tests/Extensions/Gedmo/TreeRightTest.php +++ b/tests/Extensions/Gedmo/TreeRightTest.php @@ -32,7 +32,7 @@ class TreeRightTest extends TestCase protected function setUp(): void { - $this->fieldName = 'rgt'; + $this->fieldName = 'rgt'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); @@ -43,8 +43,12 @@ public function test_it_should_add_itself_as_a_field_macro() { TreeRight::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -79,8 +83,9 @@ public function test_right_should_be_integer() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreeSelfReferenceTest.php b/tests/Extensions/Gedmo/TreeSelfReferenceTest.php index c0e2f3b..098a8a1 100644 --- a/tests/Extensions/Gedmo/TreeSelfReferenceTest.php +++ b/tests/Extensions/Gedmo/TreeSelfReferenceTest.php @@ -28,7 +28,7 @@ class TreeSelfReferenceTest extends TestCase protected function setUp(): void { - $this->fieldName = 'root'; + $this->fieldName = 'root'; $this->classMetadata = new ExtensibleClassMetadata('foo'); Field::make(new ClassMetadataBuilder($this->classMetadata), 'integer', $this->fieldName)->build(); } @@ -40,8 +40,12 @@ public function test_it_should_add_itself_as_a_field_macro($method) { TreeSelfReference::enable(); - $field = Field::make(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), 'integer', $this->fieldName + $field = Field::make( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + 'integer', + $this->fieldName )->build(); $this->assertInstanceOf( @@ -57,8 +61,13 @@ public function test_it_should_add_itself_as_a_many_to_one_macro($method) { TreeSelfReference::enable(); - $relation = new ManyToOne(new ClassMetadataBuilder( - new ExtensibleClassMetadata('Foo')), new DefaultNamingStrategy(), $this->fieldName, 'Foo' + $relation = new ManyToOne( + new ClassMetadataBuilder( + new ExtensibleClassMetadata('Foo') + ), + new DefaultNamingStrategy(), + $this->fieldName, + 'Foo' ); $this->assertInstanceOf( @@ -148,8 +157,9 @@ public function getKeys() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/TreeStrategyTest.php b/tests/Extensions/Gedmo/TreeStrategyTest.php index cc67661..b8b9b54 100644 --- a/tests/Extensions/Gedmo/TreeStrategyTest.php +++ b/tests/Extensions/Gedmo/TreeStrategyTest.php @@ -36,6 +36,7 @@ abstract class TreeStrategyTest extends TestCase /** * @param Fluent $builder + * * @return TreeStrategy */ abstract protected function getStrategy(Fluent $builder); @@ -46,8 +47,8 @@ abstract protected function getStrategy(Fluent $builder); protected function bootStrategy() { $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); - $this->strategy = $this->getStrategy($this->builder); + $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata)); + $this->strategy = $this->getStrategy($this->builder); } public function test_it_should_create_a_belongs_to_relation_to_the_parent_class_on_the_given_field() @@ -62,6 +63,7 @@ public function test_it_should_create_a_belongs_to_relation_to_the_parent_class_ /** * @param string $fieldName + * * @dataProvider getAllFields */ public function test_can_set_a_custom_field($fieldName) @@ -73,6 +75,7 @@ public function test_can_set_a_custom_field($fieldName) /** * @param string $fieldName + * * @dataProvider getNumericFields */ public function test_can_set_a_custom_field_as_integer($fieldName) @@ -84,6 +87,7 @@ public function test_can_set_a_custom_field_as_integer($fieldName) /** * @param string $fieldName + * * @dataProvider getNumericFields */ public function test_can_set_a_custom_field_as_big_int($fieldName) @@ -95,6 +99,7 @@ public function test_can_set_a_custom_field_as_big_int($fieldName) /** * @param string $fieldName + * * @dataProvider getNumericFields */ public function test_can_set_a_custom_field_as_small_int($fieldName) @@ -116,6 +121,7 @@ public function test_it_should_not_allow_strings_in_any_numeric_field($fieldName /** * @dataProvider getNumericFields + * * @param string $fieldName */ public function test_it_allows_further_field_configuration_through_a_callback($fieldName) @@ -123,7 +129,7 @@ public function test_it_allows_further_field_configuration_through_a_callback($f $mock = \Mockery::mock(['callMe' => true]); $mock->shouldReceive('callMe')->once(); - $this->strategy->$fieldName('custom', 'integer', function($field) use ($mock) { + $this->strategy->$fieldName('custom', 'integer', function ($field) use ($mock) { $this->assertInstanceOf(Field::class, $field); $mock->callMe(); }); @@ -137,7 +143,7 @@ public function test_it_allows_relation_configuration_through_a_callback($relati $mock = \Mockery::mock(['callMe' => true]); $mock->shouldReceive('callMe')->once(); - $this->strategy->$relation('myself', function($belongsTo) use ($mock) { + $this->strategy->$relation('myself', function ($belongsTo) use ($mock) { $this->assertInstanceOf(ManyToOne::class, $belongsTo); $mock->callMe(); }); @@ -145,12 +151,11 @@ public function test_it_allows_relation_configuration_through_a_callback($relati public function test_it_always_maps_the_parent_self_reference_relation() { - $this->strategy->build(); + $this->strategy->build(); $this->assertExtensionKeyEquals('parent', 'parent'); } - public function getNumericFields() { return [ @@ -173,8 +178,9 @@ public function getAllFields() * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertExtensionEquals(array $expected) { @@ -185,10 +191,11 @@ protected function assertExtensionEquals(array $expected) * Assert that a given key of the built extension matches the expected value. * * @param string $key - * @param mixed $expected + * @param mixed $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertExtensionKeyEquals($key, $expected) { diff --git a/tests/Extensions/Gedmo/TreeTest.php b/tests/Extensions/Gedmo/TreeTest.php index 009978c..37af55c 100644 --- a/tests/Extensions/Gedmo/TreeTest.php +++ b/tests/Extensions/Gedmo/TreeTest.php @@ -44,12 +44,13 @@ class TreeTest extends TestCase protected function setUp(): void { $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); - $this->extension = new Tree($this->builder); + $this->builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); + $this->extension = new Tree($this->builder); } /** * @runInSeparateProcess + * * @preserveGlobalState false */ public function test_it_should_add_itself_as_a_builder_macro() @@ -64,6 +65,7 @@ public function test_it_should_add_itself_as_a_builder_macro() /** * @runInSeparateProcess + * * @preserveGlobalState false */ public function test_it_should_add_itself_as_a_builder_macro_with_optional_callback() @@ -73,21 +75,21 @@ public function test_it_should_add_itself_as_a_builder_macro_with_optional_callb $mock = \Mockery::mock(['callMe' => true]); $mock->shouldReceive('callMe')->once(); - $this->builder->tree(function(Tree $tree) use ($mock) { + $this->builder->tree(function (Tree $tree) use ($mock) { $mock->callMe(); }); } public function test_it_delegates_on_a_nested_set_buildable() { - $nested = $this->extension->asNestedSet(); + $nested = $this->extension->asNestedSet(); $this->assertInstanceOf(NestedSet::class, $nested); } public function test_it_builds_the_delegated_nested_set_on_build() { - $this->extension->asNestedSet(); + $this->extension->asNestedSet(); $this->extension->build(); $this->assertEquals('nested', $this->classMetadata->getExtension($this->getExtensionName())['strategy']); @@ -95,14 +97,14 @@ public function test_it_builds_the_delegated_nested_set_on_build() public function test_it_delegates_on_a_materialized_path_buildable() { - $materializedPath = $this->extension->asMaterializedPath(); + $materializedPath = $this->extension->asMaterializedPath(); $this->assertInstanceOf(MaterializedPath::class, $materializedPath); } public function test_it_builds_the_delegated_materialized_path_on_build() { - $this->extension->asMaterializedPath(); + $this->extension->asMaterializedPath(); $this->extension->build(); $this->assertEquals('materializedPath', $this->classMetadata->getExtension($this->getExtensionName())['strategy']); @@ -110,27 +112,27 @@ public function test_it_builds_the_delegated_materialized_path_on_build() public function test_it_delegates_on_a_closure_table_buildable() { - $materializedPath = $this->extension->asClosureTable("Foo"); + $materializedPath = $this->extension->asClosureTable('Foo'); $this->assertInstanceOf(ClosureTable::class, $materializedPath); } public function test_it_builds_the_delegated_closure_table_on_build() { - $this->extension->asClosureTable("Foo"); + $this->extension->asClosureTable('Foo'); $this->extension->build(); $this->assertEquals('closure', $this->classMetadata->getExtension($this->getExtensionName())['strategy']); } - /** * Assert that the resulting build matches exactly with the given array. * * @param array $expected * - * @return void * @throws \PHPUnit_Framework_ExpectationFailedException + * + * @return void */ protected function assertBuildResultIs(array $expected) { diff --git a/tests/Extensions/Gedmo/UploadableFileTest.php b/tests/Extensions/Gedmo/UploadableFileTest.php index 494ebde..2aecbac 100644 --- a/tests/Extensions/Gedmo/UploadableFileTest.php +++ b/tests/Extensions/Gedmo/UploadableFileTest.php @@ -24,25 +24,26 @@ class UploadableFileTest extends TestCase protected function setUp(): void { - $this->classMetadata = new ExtensibleClassMetadata("Foo"); + $this->classMetadata = new ExtensibleClassMetadata('Foo'); } /** * @dataProvider getTypes - * + * * @param string $type + * * @return void */ public function test_it_adds_itself_as_a_field_macro_for_type($type) { - UploadableFile::enable(); + UploadableFile::enable(); $field = Field::make(new ClassMetadataBuilder($this->classMetadata), 'string', $this->fieldName); - + call_user_func([$field, "asFile$type"])->build(); - + $this->assertExtension([ - "file{$type}Field" => $this->fieldName + "file{$type}Field" => $this->fieldName, ]); } @@ -55,62 +56,61 @@ public function getTypes() ['MimeType'], ]; } - - + public function test_it_holds_the_path() { - $this->getBuilder("Path")->build(); - + $this->getBuilder('Path')->build(); + $this->assertExtension([ - 'filePathField' => $this->fieldName + 'filePathField' => $this->fieldName, ]); } - + public function test_it_holds_the_name() { - $this->getBuilder("Name")->build(); - + $this->getBuilder('Name')->build(); + $this->assertExtension([ - 'fileNameField' => $this->fieldName + 'fileNameField' => $this->fieldName, ]); } - + public function test_it_holds_the_size() { - $this->getBuilder("Size")->build(); - + $this->getBuilder('Size')->build(); + $this->assertExtension([ - 'fileSizeField' => $this->fieldName + 'fileSizeField' => $this->fieldName, ]); } - + public function test_it_holds_the_mime_type() { - $this->getBuilder("MimeType")->build(); - + $this->getBuilder('MimeType')->build(); + $this->assertExtension([ - 'fileMimeTypeField' => $this->fieldName + 'fileMimeTypeField' => $this->fieldName, ]); } - + public function test_it_validates_the_type() { $this->expectException(InvalidMappingException::class); - - $this->getBuilder("Foo")->build(); + + $this->getBuilder('Foo')->build(); } - + public function test_it_merges_with_previous_extension_config() { - $this->classMetadata->addExtension(Fluent::EXTENSION_NAME, ['foo' => 'bar']); + $this->classMetadata->addExtension(Fluent::EXTENSION_NAME, ['foo' => 'bar']); $this->getBuilder('Name')->build(); - + $this->assertExtension([ - 'foo' => 'bar', - 'fileNameField' => $this->fieldName + 'foo' => 'bar', + 'fileNameField' => $this->fieldName, ]); } - + /** * @param string $type * diff --git a/tests/Extensions/Gedmo/UploadableTest.php b/tests/Extensions/Gedmo/UploadableTest.php index 56ae0fb..b2114a9 100644 --- a/tests/Extensions/Gedmo/UploadableTest.php +++ b/tests/Extensions/Gedmo/UploadableTest.php @@ -2,10 +2,10 @@ namespace Tests\Extensions\Gedmo; -use Doctrine\Persistence\Mapping\RuntimeReflectionService; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\DefaultNamingStrategy; +use Doctrine\Persistence\Mapping\RuntimeReflectionService; use Gedmo\Exception\InvalidMappingException; use Gedmo\Uploadable\FilenameGenerator\FilenameGeneratorInterface; use Gedmo\Uploadable\Mapping\Driver\Fluent; @@ -42,7 +42,7 @@ public function test_it_should_add_itself_as_a_builder_macro() { Uploadable::enable(); - $builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $this->assertInstanceOf( Uploadable::class, @@ -54,7 +54,7 @@ public function test_it_should_add_uploadable_file_as_a_field_macro() { Uploadable::enable(); - $builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $builder = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $builder->uploadable(); $builder->string('fooes')->asFileName(); @@ -208,7 +208,7 @@ public function test_it_shouldnt_allow_and_disallow_at_the_same_time() { $this->expectException(InvalidMappingException::class); - $this->workingBuilder()->allow('jpg')->disallow('doc')->build(); + $this->workingBuilder()->allow('jpg')->disallow('doc')->build(); } public function test_it_needs_a_field_set_up_as_path_or_name() @@ -248,7 +248,7 @@ public function test_it_validates_that_file_path_field_is_mapped_as_a_string($ty Uploadable::enable(); - $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $fluent->uploadable(); $fluent->field($type, 'bar')->asFilePath(); $fluent->build(); @@ -263,7 +263,7 @@ public function test_it_validates_that_file_name_field_is_mapped_as_a_string($ty Uploadable::enable(); - $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $fluent->uploadable(); $fluent->field($type, 'bar')->asFileName(); $fluent->build(); @@ -278,7 +278,7 @@ public function test_it_validates_that_file_mime_type_field_is_mapped_as_a_strin Uploadable::enable(); - $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $fluent->uploadable(); $fluent->field($type, 'bar')->asFileMimeType(); $fluent->build(); @@ -293,7 +293,7 @@ public function test_it_validates_that_file_mime_type_field_is_mapped_as_a_decim Uploadable::enable(); - $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy); + $fluent = new Builder(new ClassMetadataBuilder($this->classMetadata), new DefaultNamingStrategy()); $fluent->uploadable(); $fluent->field($type, 'bar')->asFileSize(); $fluent->build(); @@ -323,7 +323,7 @@ private function defaults(array $overrides = []) 'filePathField' => false, 'fileSizeField' => false, 'filenameGenerator' => Validator::FILENAME_GENERATOR_NONE, - 'maxSize' => (double)0, + 'maxSize' => (float) 0, 'allowedTypes' => false, 'disallowedTypes' => false, ], $overrides); @@ -356,7 +356,7 @@ private function getTypesExcept($type) $types = Type::getTypesMap(); unset($types[$type]); - return array_map(function($type){ + return array_map(function ($type) { return [$type]; }, array_keys($types)); } diff --git a/tests/Extensions/Gedmo/VersionedTest.php b/tests/Extensions/Gedmo/VersionedTest.php index cb5125c..7e6ec07 100644 --- a/tests/Extensions/Gedmo/VersionedTest.php +++ b/tests/Extensions/Gedmo/VersionedTest.php @@ -32,7 +32,7 @@ class VersionedTest extends TestCase protected function setUp(): void { $this->classMetadata = new ExtensibleClassMetadata('foo'); - $this->fieldName = 'someField'; + $this->fieldName = 'someField'; $this->builder = new Versioned($this->classMetadata, $this->fieldName); } @@ -60,7 +60,6 @@ public function test_it_should_add_versioned_as_a_many_to_one_macro() 'SomeEntity' ); - $relation->versioned(); $relation->build(); @@ -78,7 +77,6 @@ public function test_it_should_add_versioned_as_a_one_to_one_macro() 'SomeEntity' ); - $relation->versioned(); $relation->build(); diff --git a/tests/Extensions/GedmoExtensionsTest.php b/tests/Extensions/GedmoExtensionsTest.php index 777fb62..53bae5c 100644 --- a/tests/Extensions/GedmoExtensionsTest.php +++ b/tests/Extensions/GedmoExtensionsTest.php @@ -2,9 +2,9 @@ namespace Tests\Extensions; -use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\DefaultNamingStrategy; +use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use Gedmo\Loggable\Entity\LogEntry; use Gedmo\Loggable\Entity\MappedSuperclass\AbstractLogEntry; use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation; diff --git a/tests/FluentDriverTest.php b/tests/FluentDriverTest.php index 64d996e..809d8fb 100644 --- a/tests/FluentDriverTest.php +++ b/tests/FluentDriverTest.php @@ -2,10 +2,10 @@ namespace Tests; -use Doctrine\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; +use Doctrine\Persistence\Mapping\ClassMetadata; use LaravelDoctrine\Fluent\Builders\Builder; use LaravelDoctrine\Fluent\EntityMapping; use LaravelDoctrine\Fluent\Fluent; @@ -25,9 +25,9 @@ class FluentDriverTest extends TestCase { public function test_it_should_load_metadata_for_entities_that_were_added_to_it() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new FakeClassMapping); + $driver->addMapping(new FakeClassMapping()); $driver->loadMetadataForClass( FakeEntity::class, new ClassMetadataInfo(FakeEntity::class) @@ -41,9 +41,9 @@ public function test_it_should_load_metadata_for_entities_that_were_added_to_it( public function test_it_should_load_metadata_for_embeddables_that_were_added_to_it() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new StubEmbeddableMapping); + $driver->addMapping(new StubEmbeddableMapping()); $driver->loadMetadataForClass( StubEmbeddable::class, new ClassMetadataInfo(StubEmbeddable::class) @@ -57,9 +57,9 @@ public function test_it_should_load_metadata_for_embeddables_that_were_added_to_ public function test_it_should_load_metadata_for_mapped_super_classes_that_were_added_to_it() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new StubMappedSuperClassMapping); + $driver->addMapping(new StubMappedSuperClassMapping()); $driver->loadMetadataForClass( StubMappedSuperClass::class, new ClassMetadataInfo(StubMappedSuperClass::class) @@ -76,7 +76,7 @@ public function test_it_should_load_metadata_for_mappings_passed_as_constructor_ $driver = new FluentDriver([ StubEntityMapping::class, StubEmbeddableMapping::class, - StubMappedSuperClassMapping::class + StubMappedSuperClassMapping::class, ]); $driver->loadMetadataForClass( @@ -109,11 +109,11 @@ public function test_it_should_load_metadata_for_mappings_passed_as_constructor_ public function test_can_add_array_of_new_mappings() { - $driver = new FluentDriver; + $driver = new FluentDriver(); $driver->addMappings([ FakeClassMapping::class, - StubEntityMapping::class + StubEntityMapping::class, ]); $this->assertContains( @@ -132,10 +132,10 @@ public function test_the_given_mapping_class_should_exist() $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Mapping class [Tests\DoesnExist] does not exist'); - $driver = new FluentDriver; + $driver = new FluentDriver(); $driver->addMappings([ - DoesnExist::class + DoesnExist::class, ]); } @@ -144,19 +144,19 @@ public function test_the_given_mapping_class_should_implement_mapping() $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Mapping class [Tests\Stubs\Entities\StubEntity] should implement LaravelDoctrine\Fluent\Mapping'); - $driver = new FluentDriver; + $driver = new FluentDriver(); $driver->addMappings([ - StubEntity::class + StubEntity::class, ]); } public function test_it_should_return_all_class_names_of_loaded_entities() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new FakeClassMapping); - $driver->addMapping(new StubEntityMapping); + $driver->addMapping(new FakeClassMapping()); + $driver->addMapping(new StubEntityMapping()); $this->assertContains( FakeEntity::class, @@ -171,34 +171,34 @@ public function test_it_should_return_all_class_names_of_loaded_entities() public function test_entities_should_not_be_transient() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new FakeClassMapping); + $driver->addMapping(new FakeClassMapping()); $this->assertFalse($driver->isTransient(FakeEntity::class)); } public function test_embeddables_should_be_transient() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new StubEmbeddableMapping); + $driver->addMapping(new StubEmbeddableMapping()); $this->assertTrue($driver->isTransient(StubEmbeddable::class)); } public function test_mapped_super_classes_should_not_be_transient() { - $driver = new FluentDriver; + $driver = new FluentDriver(); - $driver->addMapping(new StubMappedSuperClassMapping); + $driver->addMapping(new StubMappedSuperClassMapping()); $this->assertFalse($driver->isTransient(StubMappedSuperClass::class)); } public function test_unmapped_classes_should_be_transient() { - $driver = new FluentDriver; + $driver = new FluentDriver(); $this->assertTrue($driver->isTransient(StubMappedSuperClass::class)); } @@ -248,7 +248,8 @@ public function mapFor() class FakeEntity { - protected $id, $name; + protected $id; + protected $name; } class CustomBuilder extends Builder diff --git a/tests/Mappers/EmbeddableMapperTest.php b/tests/Mappers/EmbeddableMapperTest.php index 3bd3cfc..3cdd19a 100644 --- a/tests/Mappers/EmbeddableMapperTest.php +++ b/tests/Mappers/EmbeddableMapperTest.php @@ -20,7 +20,7 @@ class EmbeddableMapperTest extends TestCase protected function setUp(): void { - $mapping = new StubEmbeddableMapping(); + $mapping = new StubEmbeddableMapping(); $this->mapper = new EmbeddableMapper($mapping); } @@ -37,7 +37,7 @@ public function test_it_should_be_transient() public function test_it_should_delegate_the_proper_mapping_to_the_mapping_class() { $metadata = new ClassMetadataInfo(StubEmbeddable::class); - $builder = new Builder(new ClassMetadataBuilder($metadata)); + $builder = new Builder(new ClassMetadataBuilder($metadata)); $this->mapper->map($builder); diff --git a/tests/Mappers/EntityMapperTest.php b/tests/Mappers/EntityMapperTest.php index 38dc5ac..81d66cb 100644 --- a/tests/Mappers/EntityMapperTest.php +++ b/tests/Mappers/EntityMapperTest.php @@ -20,7 +20,7 @@ class EntityMapperTest extends TestCase protected function setUp(): void { - $mapping = new StubEntityMapping; + $mapping = new StubEntityMapping(); $this->mapper = new EntityMapper($mapping); } @@ -37,7 +37,7 @@ public function test_it_should_not_be_transient() public function test_it_should_delegate_the_proper_mapping_to_the_mapping_class() { $metadata = new ClassMetadataInfo(StubEntity::class); - $builder = new Builder(new ClassMetadataBuilder($metadata)); + $builder = new Builder(new ClassMetadataBuilder($metadata)); $this->mapper->map($builder); diff --git a/tests/Mappers/MappedSuperClassMapperTest.php b/tests/Mappers/MappedSuperClassMapperTest.php index 3616725..310e50f 100644 --- a/tests/Mappers/MappedSuperClassMapperTest.php +++ b/tests/Mappers/MappedSuperClassMapperTest.php @@ -20,7 +20,7 @@ class MappedSuperClassMapperTest extends TestCase protected function setUp(): void { - $mapping = new StubMappedSuperClassMapping(); + $mapping = new StubMappedSuperClassMapping(); $this->mapper = new MappedSuperClassMapper($mapping); } @@ -37,7 +37,7 @@ public function test_it_should_not_be_transient() public function test_it_should_delegate_the_proper_mapping_to_the_mapping_class() { $metadata = new ClassMetadataInfo(StubMappedSuperClass::class); - $builder = new Builder(new ClassMetadataBuilder($metadata)); + $builder = new Builder(new ClassMetadataBuilder($metadata)); $this->mapper->map($builder); diff --git a/tests/Mappers/MapperSetTest.php b/tests/Mappers/MapperSetTest.php index a5b97d5..3d1ba7c 100644 --- a/tests/Mappers/MapperSetTest.php +++ b/tests/Mappers/MapperSetTest.php @@ -15,15 +15,15 @@ class MapperSetTest extends TestCase { /** - * @type MapperSet + * @var MapperSet */ protected $mapperSet; protected function setUp(): void { - $this->mapperSet = new MapperSet; - $this->mapperSet->add(new StubEntityMapping); - $this->mapperSet->add(new StubEmbeddableMapping); + $this->mapperSet = new MapperSet(); + $this->mapperSet->add(new StubEntityMapping()); + $this->mapperSet->add(new StubEmbeddableMapping()); } public function test_it_should_accumulate_mapping_implementations() @@ -55,19 +55,19 @@ public function test_can_check_if_has_mapper_for_class() public function test_can_check_if_has_mappers() { - $set = new MapperSet; + $set = new MapperSet(); $this->assertFalse($set->hasMappers()); - $set->add(new StubEntityMapping); + $set->add(new StubEntityMapping()); $this->assertTrue($set->hasMappers()); } public function test_can_get_mappers() { - $set = new MapperSet; + $set = new MapperSet(); $this->assertCount(0, $set->getMappers()); - $mapping = new StubEntityMapping; + $mapping = new StubEntityMapping(); $set->add($mapping); $this->assertCount(1, $set->getMappers()); diff --git a/tests/Relations/ManyToManyTest.php b/tests/Relations/ManyToManyTest.php index 7f3fe92..32cf25b 100644 --- a/tests/Relations/ManyToManyTest.php +++ b/tests/Relations/ManyToManyTest.php @@ -16,7 +16,13 @@ class ManyToManyTest extends RelationTestCase { - use Indexable, Orderable, Owning, Ownable, NonPrimary, IsMacroable, MockeryPHPUnitIntegration; + use Indexable; + use Orderable; + use Owning; + use Ownable; + use NonPrimary; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ManyToMany @@ -39,8 +45,12 @@ protected function setUp(): void FluentEntity::class )); - $this->relation = new ManyToMany($this->builder, new DefaultNamingStrategy(), $this->field, - FluentEntity::class); + $this->relation = new ManyToMany( + $this->builder, + new DefaultNamingStrategy(), + $this->field, + FluentEntity::class + ); } public function test_can_set_join_table() @@ -59,8 +69,10 @@ public function test_can_set_join_column() $this->relation->build(); $this->assertEquals('join_column', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -72,8 +84,10 @@ public function test_can_set_unique_join_column() $this->relation->build(); $this->assertEquals('join_column', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertTrue($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -85,8 +99,10 @@ public function test_can_set_foreign_key() $this->relation->build(); $this->assertEquals('foreign_key', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -98,8 +114,10 @@ public function test_can_set_unique_foreign_key() $this->relation->build(); $this->assertEquals('foreign_key', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertTrue($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -111,8 +129,10 @@ public function test_can_set_source() $this->relation->build(); $this->assertEquals('source', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -124,8 +144,10 @@ public function test_can_set_unique_source() $this->relation->build(); $this->assertEquals('source', $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['nullable']); $this->assertTrue($this->getAssocValue($this->field, 'joinTable')['joinColumns'][0]['unique']); } @@ -136,10 +158,14 @@ public function test_can_set_inverseKey() $this->relation->build(); - $this->assertEquals('inverse_key', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'inverse_key', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name'] + ); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['nullable']); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['unique']); } @@ -150,10 +176,14 @@ public function test_can_set_unique_inverseKey() $this->relation->build(); - $this->assertEquals('inverse_key', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'inverse_key', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name'] + ); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['nullable']); $this->assertTrue($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['unique']); } @@ -165,8 +195,10 @@ public function test_can_set_target() $this->relation->build(); $this->assertEquals('target', $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['nullable']); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['unique']); } @@ -178,8 +210,10 @@ public function test_can_set_unique_target() $this->relation->build(); $this->assertEquals('target', $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['name']); - $this->assertEquals('other_reference', - $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName']); + $this->assertEquals( + 'other_reference', + $this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['referencedColumnName'] + ); $this->assertFalse($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['nullable']); $this->assertTrue($this->getAssocValue($this->field, 'joinTable')['inverseJoinColumns'][0]['unique']); } diff --git a/tests/Relations/ManyToOneTest.php b/tests/Relations/ManyToOneTest.php index 77ae26a..b5c7b0c 100644 --- a/tests/Relations/ManyToOneTest.php +++ b/tests/Relations/ManyToOneTest.php @@ -15,7 +15,10 @@ class ManyToOneTest extends RelationTestCase { - use Owning, Primary, IsMacroable, MockeryPHPUnitIntegration; + use Owning; + use Primary; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ManyToOne diff --git a/tests/Relations/OneToManyTest.php b/tests/Relations/OneToManyTest.php index 97ce41d..c33f927 100644 --- a/tests/Relations/OneToManyTest.php +++ b/tests/Relations/OneToManyTest.php @@ -15,7 +15,11 @@ class OneToManyTest extends RelationTestCase { - use OneTo, Indexable, Orderable, Ownable, NonPrimary; + use OneTo; + use Indexable; + use Orderable; + use Ownable; + use NonPrimary; /** * @var OneToMany diff --git a/tests/Relations/OneToOneTest.php b/tests/Relations/OneToOneTest.php index f177497..df51cbd 100644 --- a/tests/Relations/OneToOneTest.php +++ b/tests/Relations/OneToOneTest.php @@ -17,7 +17,12 @@ class OneToOneTest extends RelationTestCase { - use OneTo, Owning, Ownable, Primary, IsMacroable, MockeryPHPUnitIntegration; + use OneTo; + use Owning; + use Ownable; + use Primary; + use IsMacroable; + use MockeryPHPUnitIntegration; /** * @var ManyToOne diff --git a/tests/Relations/RelationTestCase.php b/tests/Relations/RelationTestCase.php index 4b43d91..e379069 100644 --- a/tests/Relations/RelationTestCase.php +++ b/tests/Relations/RelationTestCase.php @@ -68,7 +68,7 @@ public function test_can_cache_the_association() $cache = $this->getAssocValue($this->field, 'cache'); $this->assertEquals(1, $cache['usage']); - $this->assertEquals('tests_relations_fluententity__' . $this->field, $cache['region']); + $this->assertEquals('tests_relations_fluententity__'.$this->field, $cache['region']); } public function test_can_cache_the_association_with_usage() @@ -79,7 +79,7 @@ public function test_can_cache_the_association_with_usage() $cache = $this->getAssocValue($this->field, 'cache'); $this->assertEquals(3, $cache['usage']); - $this->assertEquals('tests_relations_fluententity__' . $this->field, $cache['region']); + $this->assertEquals('tests_relations_fluententity__'.$this->field, $cache['region']); } public function test_valid_cache_usage_should_be_given() @@ -126,5 +126,6 @@ protected function getAssocValue($field, $option) class FluentEntity { - protected $parent, $children; + protected $parent; + protected $children; } diff --git a/tests/Relations/Traits/NonPrimary.php b/tests/Relations/Traits/NonPrimary.php index 2cd5b32..58ba2b5 100644 --- a/tests/Relations/Traits/NonPrimary.php +++ b/tests/Relations/Traits/NonPrimary.php @@ -9,7 +9,7 @@ public function test_can_not_set_primary_key() $this->assertFalse($this->relation->getBuilder()->getClassMetadata()->isIdentifier($this->field)); $this->expectException('Doctrine\ORM\Mapping\MappingException'); - $this->expectExceptionMessage('Many-to-many or one-to-many associations are not allowed to be identifier in \'Tests\Relations\FluentEntity#' . $this->field . '\''); + $this->expectExceptionMessage('Many-to-many or one-to-many associations are not allowed to be identifier in \'Tests\Relations\FluentEntity#'.$this->field.'\''); $this->relation->makePrimaryKey(); $this->relation->build(); diff --git a/tests/Stubs/Entities/StubEntity.php b/tests/Stubs/Entities/StubEntity.php index 5ee27ec..352e760 100644 --- a/tests/Stubs/Entities/StubEntity.php +++ b/tests/Stubs/Entities/StubEntity.php @@ -4,5 +4,11 @@ class StubEntity { - protected $id, $name, $parent, $children, $one, $many, $slug; + protected $id; + protected $name; + protected $parent; + protected $children; + protected $one; + protected $many; + protected $slug; } diff --git a/tests/Stubs/Entities/StubEntity2.php b/tests/Stubs/Entities/StubEntity2.php index 9f812e4..7b4956c 100644 --- a/tests/Stubs/Entities/StubEntity2.php +++ b/tests/Stubs/Entities/StubEntity2.php @@ -4,5 +4,6 @@ class StubEntity2 { - protected $id, $name; + protected $id; + protected $name; } diff --git a/tests/Stubs/Entities/StubEntity3.php b/tests/Stubs/Entities/StubEntity3.php index dda608d..c653828 100644 --- a/tests/Stubs/Entities/StubEntity3.php +++ b/tests/Stubs/Entities/StubEntity3.php @@ -4,5 +4,6 @@ class StubEntity3 { - protected $id, $name; + protected $id; + protected $name; } diff --git a/tests/Stubs/Mappings/StubEmbeddableMapping.php b/tests/Stubs/Mappings/StubEmbeddableMapping.php index 80cdd27..38b51f6 100644 --- a/tests/Stubs/Mappings/StubEmbeddableMapping.php +++ b/tests/Stubs/Mappings/StubEmbeddableMapping.php @@ -20,6 +20,7 @@ public function map(Fluent $builder) /** * Returns the fully qualified name of the entity that this mapper maps. + * * @return string */ public function mapFor() diff --git a/tests/Stubs/Mappings/StubMappedSuperClassMapping.php b/tests/Stubs/Mappings/StubMappedSuperClassMapping.php index f88a9fd..c76a891 100644 --- a/tests/Stubs/Mappings/StubMappedSuperClassMapping.php +++ b/tests/Stubs/Mappings/StubMappedSuperClassMapping.php @@ -20,6 +20,7 @@ public function map(Fluent $builder) /** * Returns the fully qualified name of the entity that this mapper maps. + * * @return string */ public function mapFor() diff --git a/tests/Stubs/StubEntityListener.php b/tests/Stubs/StubEntityListener.php index 8f6b83d..820f8ad 100644 --- a/tests/Stubs/StubEntityListener.php +++ b/tests/Stubs/StubEntityListener.php @@ -23,4 +23,4 @@ public function preRemove() public function onClear() { } -} \ No newline at end of file +}