Skip to content

Commit 37defa0

Browse files
committed
minor #1132 [csm] fix incomplete test (jrushlow)
This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- [csm] fix incomplete test - this is the only spot in maker where we consider `tabs` vs `spaces` - lets stay out of that philosophy of coding debate and just stick w/ spaces. - removes reflection calls that are not needed. Commits ------- 7880f09 [csm] fix incomplete test
2 parents 48c1634 + 7880f09 commit 37defa0

File tree

3 files changed

+3
-66
lines changed

3 files changed

+3
-66
lines changed

tests/Util/ClassSourceManipulatorTest.php

Lines changed: 3 additions & 28 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
}
@@ -624,25 +618,6 @@ public function getAddOneToOneRelationTests(): \Generator
624618
];
625619
}
626620

627-
public function testGenerationWithTabs(): void
628-
{
629-
$this->markTestIncomplete('We need to refactor the invoked addProperty method to pass an attribute node instead of an annotation array');
630-
$source = file_get_contents(__DIR__.'/fixtures/source/ProductWithTabs.php');
631-
$expectedSource = file_get_contents(__DIR__.'/fixtures/with_tabs/ProductWithTabs.php');
632-
633-
$manipulator = new ClassSourceManipulator($source);
634-
635-
$method = (new \ReflectionObject($manipulator))->getMethod('addProperty');
636-
$method->setAccessible(true);
637-
$method->invoke($manipulator, 'name', ['@ORM\Column(type="string", length=255)']);
638-
639-
$method = (new \ReflectionObject($manipulator))->getMethod('addGetter');
640-
$method->setAccessible(true);
641-
$method->invoke($manipulator, 'id', 'int', false);
642-
643-
$this->assertSame($expectedSource, $manipulator->getSourceCode());
644-
}
645-
646621
public function testAddInterface(): void
647622
{
648623
$source = file_get_contents(__DIR__.'/fixtures/source/User_simple.php');

tests/Util/fixtures/source/ProductWithTabs.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/Util/fixtures/with_tabs/ProductWithTabs.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)