Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions tests/Util/ClassSourceManipulatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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');
Expand Down
15 changes: 0 additions & 15 deletions tests/Util/fixtures/source/ProductWithTabs.php

This file was deleted.

23 changes: 0 additions & 23 deletions tests/Util/fixtures/with_tabs/ProductWithTabs.php

This file was deleted.