diff --git a/tests/Util/ClassSourceManipulatorTest.php b/tests/Util/ClassSourceManipulatorTest.php index 43b3485f0..a3efdd621 100644 --- a/tests/Util/ClassSourceManipulatorTest.php +++ b/tests/Util/ClassSourceManipulatorTest.php @@ -33,9 +33,7 @@ public function testAddProperty(string $sourceFilename, $propertyName, array $co $expectedSource = file_get_contents(__DIR__.'/fixtures/add_property/'.$expectedSourceFilename); $manipulator = new ClassSourceManipulator($source); - $method = (new \ReflectionObject($manipulator))->getMethod('addProperty'); - $method->setAccessible(true); - $method->invoke($manipulator, name: $propertyName, comments: $commentLines); + $manipulator->addProperty(name: $propertyName, comments: $commentLines); $this->assertSame($expectedSource, $manipulator->getSourceCode()); } @@ -83,9 +81,7 @@ public function testAddGetter(string $sourceFilename, string $propertyName, stri $expectedSource = file_get_contents(__DIR__.'/fixtures/add_getter/'.$expectedSourceFilename); $manipulator = new ClassSourceManipulator($source); - $method = (new \ReflectionObject($manipulator))->getMethod('addGetter'); - $method->setAccessible(true); - $method->invoke($manipulator, $propertyName, $type, true, $commentLines); + $manipulator->addGetter($propertyName, $type, true, $commentLines); $this->assertSame($expectedSource, $manipulator->getSourceCode()); } @@ -137,9 +133,7 @@ public function testAddSetter(string $sourceFilename, string $propertyName, stri $expectedSource = file_get_contents(__DIR__.'/fixtures/add_setter/'.$expectedSourceFilename); $manipulator = new ClassSourceManipulator($source); - $method = (new \ReflectionObject($manipulator))->getMethod('addSetter'); - $method->setAccessible(true); - $method->invoke($manipulator, $propertyName, $type, $isNullable, $commentLines); + $manipulator->addSetter($propertyName, $type, $isNullable, $commentLines); $this->assertSame($expectedSource, $manipulator->getSourceCode()); } @@ -624,25 +618,6 @@ public function getAddOneToOneRelationTests(): \Generator ]; } - public function testGenerationWithTabs(): void - { - $this->markTestIncomplete('We need to refactor the invoked addProperty method to pass an attribute node instead of an annotation array'); - $source = file_get_contents(__DIR__.'/fixtures/source/ProductWithTabs.php'); - $expectedSource = file_get_contents(__DIR__.'/fixtures/with_tabs/ProductWithTabs.php'); - - $manipulator = new ClassSourceManipulator($source); - - $method = (new \ReflectionObject($manipulator))->getMethod('addProperty'); - $method->setAccessible(true); - $method->invoke($manipulator, 'name', ['@ORM\Column(type="string", length=255)']); - - $method = (new \ReflectionObject($manipulator))->getMethod('addGetter'); - $method->setAccessible(true); - $method->invoke($manipulator, 'id', 'int', false); - - $this->assertSame($expectedSource, $manipulator->getSourceCode()); - } - public function testAddInterface(): void { $source = file_get_contents(__DIR__.'/fixtures/source/User_simple.php'); diff --git a/tests/Util/fixtures/source/ProductWithTabs.php b/tests/Util/fixtures/source/ProductWithTabs.php deleted file mode 100644 index 5969a6fd4..000000000 --- a/tests/Util/fixtures/source/ProductWithTabs.php +++ /dev/null @@ -1,15 +0,0 @@ -id; - } -}