Skip to content

Commit 0a4607f

Browse files
committed
we dont need reflection in these tests
1 parent fefb95e commit 0a4607f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tests/Util/ClassSourceManipulatorTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function testAddProperty(string $sourceFilename, $propertyName, array $co
3333
$expectedSource = file_get_contents(__DIR__.'/fixtures/add_property/'.$expectedSourceFilename);
3434

3535
$manipulator = new ClassSourceManipulator($source);
36-
$method = (new \ReflectionObject($manipulator))->getMethod('addProperty');
37-
$method->setAccessible(true);
38-
$method->invoke($manipulator, name: $propertyName, comments: $commentLines);
36+
$manipulator->addProperty(name: $propertyName, comments: $commentLines);
3937

4038
$this->assertSame($expectedSource, $manipulator->getSourceCode());
4139
}
@@ -83,9 +81,7 @@ public function testAddGetter(string $sourceFilename, string $propertyName, stri
8381
$expectedSource = file_get_contents(__DIR__.'/fixtures/add_getter/'.$expectedSourceFilename);
8482

8583
$manipulator = new ClassSourceManipulator($source);
86-
$method = (new \ReflectionObject($manipulator))->getMethod('addGetter');
87-
$method->setAccessible(true);
88-
$method->invoke($manipulator, $propertyName, $type, true, $commentLines);
84+
$manipulator->addGetter($propertyName, $type, true, $commentLines);
8985

9086
$this->assertSame($expectedSource, $manipulator->getSourceCode());
9187
}
@@ -137,9 +133,7 @@ public function testAddSetter(string $sourceFilename, string $propertyName, stri
137133
$expectedSource = file_get_contents(__DIR__.'/fixtures/add_setter/'.$expectedSourceFilename);
138134

139135
$manipulator = new ClassSourceManipulator($source);
140-
$method = (new \ReflectionObject($manipulator))->getMethod('addSetter');
141-
$method->setAccessible(true);
142-
$method->invoke($manipulator, $propertyName, $type, $isNullable, $commentLines);
136+
$manipulator->addSetter($propertyName, $type, $isNullable, $commentLines);
143137

144138
$this->assertSame($expectedSource, $manipulator->getSourceCode());
145139
}

0 commit comments

Comments
 (0)