diff --git a/config/reliese.php b/config/reliese.php index 8e2495b9..2f88b406 100644 --- a/config/reliese.php +++ b/config/reliese.php @@ -195,7 +195,7 @@ | */ - 'connection' => false, + 'AppendConnection' => false, /* |-------------------------------------------------------------------------- diff --git a/src/Analyser/Doctrine/DoctrineDatabaseAnalyser.php b/src/Analyser/Doctrine/DoctrineDatabaseAnalyser.php index 4afe0f74..7843247f 100644 --- a/src/Analyser/Doctrine/DoctrineDatabaseAnalyser.php +++ b/src/Analyser/Doctrine/DoctrineDatabaseAnalyser.php @@ -178,4 +178,15 @@ protected function getSchemaAnalyser(DatabaseBlueprint $databaseBlueprint, strin $schemaSpecificDoctrineSchemaManager ); } + + /** + * @return string + */ + public function getConnectionName(): string + { + return $this->doctrineDatabaseAssistant->getRelieseConfiguration() + ->getDatabaseAnalyserConfiguration() + ->getConnectionName() + ; + } } diff --git a/src/Analyser/Doctrine/DoctrineDatabaseAssistantInterface.php b/src/Analyser/Doctrine/DoctrineDatabaseAssistantInterface.php index 433ac595..b406e8a9 100644 --- a/src/Analyser/Doctrine/DoctrineDatabaseAssistantInterface.php +++ b/src/Analyser/Doctrine/DoctrineDatabaseAssistantInterface.php @@ -5,6 +5,7 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\AbstractSchemaManager; use Illuminate\Database\ConnectionInterface; +use Reliese\Configuration\RelieseConfiguration; /** * Interface DoctrineDatabaseAssistantInterface @@ -30,4 +31,9 @@ public function getConnection(string $schemaName): ConnectionInterface; * @throws Exception */ public function getDoctrineSchemaManager(?string $schemaName = null): AbstractSchemaManager; + + /** + * @return RelieseConfiguration + */ + public function getRelieseConfiguration(): RelieseConfiguration; } diff --git a/src/Analyser/Doctrine/DoctrineSchemaAnalyser.php b/src/Analyser/Doctrine/DoctrineSchemaAnalyser.php index 62772e18..76030ad1 100644 --- a/src/Analyser/Doctrine/DoctrineSchemaAnalyser.php +++ b/src/Analyser/Doctrine/DoctrineSchemaAnalyser.php @@ -90,7 +90,11 @@ public function getSchemaBlueprint(): SchemaBlueprint return $this->schemaBlueprint; } - return $this->schemaBlueprint = new SchemaBlueprint($this->getDatabaseBlueprint(), $this->getSchemaName()); + return $this->schemaBlueprint = new SchemaBlueprint( + $this->getDatabaseBlueprint(), + $this->getSchemaName(), + $this->getConnectionName() + ); } /** @@ -317,4 +321,12 @@ protected function getDatabaseBlueprint(): DatabaseBlueprint { return $this->databaseBlueprint; } + + /** + * @return string + */ + public function getConnectionName(): string + { + return $this->doctrineDatabaseAnalyser->getConnectionName(); + } } diff --git a/src/Analyser/Doctrine/MySqlDoctrineDatabaseAssistant.php b/src/Analyser/Doctrine/MySqlDoctrineDatabaseAssistant.php index e3f6028d..ddf283b5 100644 --- a/src/Analyser/Doctrine/MySqlDoctrineDatabaseAssistant.php +++ b/src/Analyser/Doctrine/MySqlDoctrineDatabaseAssistant.php @@ -12,6 +12,11 @@ */ class MySqlDoctrineDatabaseAssistant implements DoctrineDatabaseAssistantInterface { + /** + * @var RelieseConfiguration + */ + private RelieseConfiguration $relieseConfiguration; + /** * @var ConnectionInterface */ @@ -40,6 +45,7 @@ public function __construct( $this->connectionFactory = $connectionFactory; $this->configuredConnection = $configuredConnection; $this->schemaConnections[$configuredConnection->getConfig('database')] = $configuredConnection; + $this->relieseConfiguration = $relieseConfiguration; } public function getSchemaNames(): array @@ -92,4 +98,12 @@ public function getDoctrineSchemaManager(?string $schemaName = null): AbstractSc return $this->doctrineSchemaManagers[$schemaName] = $doctrineSchemaManager; } + + /** + * @return RelieseConfiguration + */ + public function getRelieseConfiguration(): RelieseConfiguration + { + return $this->relieseConfiguration; + } } diff --git a/src/Analyser/Doctrine/SqliteDoctrineDatabaseAssistant.php b/src/Analyser/Doctrine/SqliteDoctrineDatabaseAssistant.php index fed28f5b..b63bb98e 100644 --- a/src/Analyser/Doctrine/SqliteDoctrineDatabaseAssistant.php +++ b/src/Analyser/Doctrine/SqliteDoctrineDatabaseAssistant.php @@ -66,4 +66,12 @@ public function getDoctrineSchemaManager(?string $schemaName = null): AbstractSc { return $this->doctrineSchemaManagers['default'] ??= $this->getConnection()->getDoctrineSchemaManager(); } + + /** + * @return RelieseConfiguration + */ + public function getRelieseConfiguration(): RelieseConfiguration + { + return $this->relieseConfiguration; + } } diff --git a/src/Blueprint/SchemaBlueprint.php b/src/Blueprint/SchemaBlueprint.php index 877eb7a3..4d4fa180 100644 --- a/src/Blueprint/SchemaBlueprint.php +++ b/src/Blueprint/SchemaBlueprint.php @@ -3,25 +3,31 @@ namespace Reliese\Blueprint; use InvalidArgumentException; + /** * Class SchemaBlueprint */ class SchemaBlueprint { + /** + * @var string + */ + private string $connectionName; + /** * @var DatabaseBlueprint */ - private $databaseBlueprint; + private DatabaseBlueprint $databaseBlueprint; /** * @var string */ - private $schemaName; + private string $schemaName; /** * @var TableBlueprint[] */ - private $tableBlueprints = []; + private array $tableBlueprints = []; /** * @var ViewBlueprint[] @@ -33,11 +39,13 @@ class SchemaBlueprint * * @param DatabaseBlueprint $databaseBlueprint * @param string $schemaName + * @param string $connectionName */ - public function __construct(DatabaseBlueprint $databaseBlueprint, string $schemaName) + public function __construct(DatabaseBlueprint $databaseBlueprint, string $schemaName, string $connectionName) { $this->schemaName = $schemaName; $this->databaseBlueprint = $databaseBlueprint; + $this->connectionName = $connectionName; } /** @@ -121,4 +129,23 @@ public function hasTableBlueprint(string $tableName) : bool { return \array_key_exists($tableName, $this->tableBlueprints); } + + /** + * @return string + */ + public function getConnectionName(): string + { + return $this->connectionName; + } + + /** + * @param string $connectionName + * + * @return SchemaBlueprint + */ + public function setConnectionName(string $connectionName): static + { + $this->connectionName = $connectionName; + return $this; + } } diff --git a/src/Blueprint/SchemaMemberTrait.php b/src/Blueprint/SchemaMemberTrait.php index 85af65b4..94ee55e7 100644 --- a/src/Blueprint/SchemaMemberTrait.php +++ b/src/Blueprint/SchemaMemberTrait.php @@ -14,10 +14,15 @@ trait SchemaMemberTrait /** * @var SchemaBlueprint */ - private $schemaBlueprint; + private SchemaBlueprint $schemaBlueprint; /** - * @return SchemaBlueprint|null + * @var string + */ + private string $name; + + /** + * @return SchemaBlueprint */ public function getSchemaBlueprint(): SchemaBlueprint { @@ -32,11 +37,6 @@ public function setSchemaBlueprint(SchemaBlueprint $schemaBlueprint) $this->schemaBlueprint = $schemaBlueprint; } - /** - * @var string - */ - private $name; - /** * Returns the name of that uniquely identifies this schema member * diff --git a/src/Blueprint/TableBlueprint.php b/src/Blueprint/TableBlueprint.php index 0a37d413..56f259df 100644 --- a/src/Blueprint/TableBlueprint.php +++ b/src/Blueprint/TableBlueprint.php @@ -31,8 +31,7 @@ class TableBlueprint implements SchemaMemberInterface, ColumnOwnerInterface * @param SchemaBlueprint $schemaBlueprint * @param string $tableName */ - public function __construct(SchemaBlueprint $schemaBlueprint, - string $tableName) + public function __construct(SchemaBlueprint $schemaBlueprint, string $tableName) { $this->setSchemaBlueprint($schemaBlueprint); $this->setName($tableName); diff --git a/src/Blueprint/ViewBlueprint.php b/src/Blueprint/ViewBlueprint.php index 06481416..0f8c4286 100644 --- a/src/Blueprint/ViewBlueprint.php +++ b/src/Blueprint/ViewBlueprint.php @@ -2,7 +2,6 @@ namespace Reliese\Blueprint; -use Doctrine\DBAL\Schema\View; /** * Class ViewBlueprint */ @@ -11,11 +10,6 @@ class ViewBlueprint implements SchemaMemberInterface, ColumnOwnerInterface use SchemaMemberTrait; use ColumnOwnerTrait; - /** - * @var SchemaBlueprint - */ - private $schemaBlueprint; - /** * ViewBlueprint constructor. * @@ -35,4 +29,14 @@ public function getSchemaMemberType(): SchemaMemberType { return SchemaMemberType::View(); } + + /** + * @inheritDoc + */ + public function getUniqueName(): string + { + return sprintf('%s.%s', + $this->getSchemaBlueprint()->getSchemaName(), + $this->getName()); + } } diff --git a/src/Configuration/ModelGeneratorConfiguration.php b/src/Configuration/ModelGeneratorConfiguration.php index a460eb18..9b889be4 100644 --- a/src/Configuration/ModelGeneratorConfiguration.php +++ b/src/Configuration/ModelGeneratorConfiguration.php @@ -2,6 +2,8 @@ namespace Reliese\Configuration; +use Illuminate\Database\Eloquent\Model; + /** * Class ModelGeneratorConfiguration */ @@ -13,6 +15,7 @@ class ModelGeneratorConfiguration const KEY_PARENT_CLASS_PREFIX = 'ParentClassPrefix'; const KEY_PARENT = 'Parent'; const KEY_TRAITS = 'Traits'; + const KEY_APPEND_CONNECTION = 'AppendConnection'; /** * @var string @@ -44,6 +47,11 @@ class ModelGeneratorConfiguration */ private array $traits = []; + /** + * @var bool + */ + private bool $appendConnection; + /** * ModelGeneratorConfiguration constructor. * @@ -51,16 +59,13 @@ class ModelGeneratorConfiguration */ public function __construct(array $configuration = []) { - if (empty($configuration)) { - return ; - } - - $this->setPath($configuration[static::KEY_PATH]); - $this->setNamespace($configuration[static::KEY_NAMESPACE]); + $this->setPath($configuration[static::KEY_PATH] ?? ''); + $this->setNamespace($configuration[static::KEY_NAMESPACE] ?? ''); $this->setClassSuffix($configuration[static::KEY_CLASS_SUFFIX] ?? ''); $this->setParentClassPrefix($configuration[static::KEY_PARENT_CLASS_PREFIX] ?? ''); - $this->setParent($configuration[static::KEY_PARENT]); + $this->setParent($configuration[static::KEY_PARENT] ?? Model::class); $this->setTraits($configuration[static::KEY_TRAITS] ?? []); + $this->appendConnection($configuration[static::KEY_APPEND_CONNECTION] ?? false); } /** @@ -181,4 +186,23 @@ public function getTraits(): array { return $this->traits; } + + /** + * @param bool $append + * + * @return $this + */ + public function appendConnection(bool $append): static + { + $this->appendConnection = $append; + return $this; + } + + /** + * @return bool + */ + public function appendsConnection(): bool + { + return $this->appendConnection; + } } diff --git a/src/Generator/Model/ModelGenerator.php b/src/Generator/Model/ModelGenerator.php index 0470b4d8..e1e2f8c4 100644 --- a/src/Generator/Model/ModelGenerator.php +++ b/src/Generator/Model/ModelGenerator.php @@ -20,6 +20,7 @@ class ModelGenerator { const PROPERTY_TABLE = 'table'; + const PROPERTY_CONNECTION = 'connection'; private MySqlDataTypeMap $dataTypeMap; @@ -221,6 +222,10 @@ private function generateProperties(TableBlueprint $tableBlueprint): array $properties[] = $this->generateTableProperty($tableBlueprint); } + if ($this->modelGeneratorConfiguration->appendsConnection()) { + $properties[] = $this->generateConnectionProperty($tableBlueprint); + } + return $properties; } @@ -241,7 +246,7 @@ private function generateTableProperty(TableBlueprint $tableBlueprint): ClassPro { $property = new ClassPropertyDefinition( static::PROPERTY_TABLE, - PhpTypeEnum::stringType(), + PhpTypeEnum::absentTypeEnum(), VisibilityEnum::protectedEnum() ); @@ -272,4 +277,22 @@ private function generateTraits(TableBlueprint $tableBlueprint): array return $traitDefinitions; } + + /** + * @param TableBlueprint $tableBlueprint + * + * @return ClassPropertyDefinition + */ + private function generateConnectionProperty(TableBlueprint $tableBlueprint): ClassPropertyDefinition + { + $property = new ClassPropertyDefinition( + static::PROPERTY_CONNECTION, + PhpTypeEnum::absentTypeEnum(), + VisibilityEnum::protectedEnum() + ); + + $property->setValue($tableBlueprint->getSchemaBlueprint()->getConnectionName()); + + return $property; + } } diff --git a/src/MetaCode/Definition/ClassDefinition.php b/src/MetaCode/Definition/ClassDefinition.php index 64d3d835..a464d67f 100644 --- a/src/MetaCode/Definition/ClassDefinition.php +++ b/src/MetaCode/Definition/ClassDefinition.php @@ -256,14 +256,14 @@ public function getTraits(): array } /** - * @param string $traitFullyQualifiedName + * @param string $fullyQualifiedTraitName * * @return bool */ - public function hasTrait(string $traitFullyQualifiedName): bool + public function hasTrait(string $fullyQualifiedTraitName): bool { foreach ($this->getTraits() as $classTraitDefinition) { - if ($classTraitDefinition->isFullyQualifiedName($traitFullyQualifiedName)) { + if ($classTraitDefinition->isFullyQualifiedName($fullyQualifiedTraitName)) { return true; } } diff --git a/src/MetaCode/Enum/PhpTypeEnum.php b/src/MetaCode/Enum/PhpTypeEnum.php index 5b9826d3..3d0d28e2 100644 --- a/src/MetaCode/Enum/PhpTypeEnum.php +++ b/src/MetaCode/Enum/PhpTypeEnum.php @@ -30,6 +30,8 @@ class PhpTypeEnum protected const STATIC_TYPE_ID = 70; protected const NULLABLE_STATIC_TYPE_ID = 75; + protected const ABSENT_TYPE_ID = 80; + private static ?PhpTypeEnum $stringTypeInstance = null; private static ?PhpTypeEnum $nullableStringTypeInstance = null; @@ -51,9 +53,11 @@ class PhpTypeEnum private static ?PhpTypeEnum $staticTypeInstance = null; private static ?PhpTypeEnum $nullableStaticTypeInstance = null; + private static ?PhpTypeEnum $absentTypeInstance = null; + /** * Only used for Array Type - * @var string|null + * @var string|null */ private ?string $containedTypeName = null; @@ -190,6 +194,11 @@ public function isNullableStatic(): bool return static::NULLABLE_STATIC_TYPE_ID === $this->phpTypeId; } + public function isAbsent(): bool + { + return static::ABSENT_TYPE_ID === $this->phpTypeId; + } + public static function stringType(): PhpTypeEnum { if (static::$stringTypeInstance) { @@ -306,6 +315,15 @@ public static function nullableStaticTypeEnum(): PhpTypeEnum return static::$nullableStaticTypeInstance = new static(static::NULLABLE_STATIC_TYPE_ID); } + public static function absentTypeEnum(): PhpTypeEnum + { + if (static::$absentTypeInstance) { + return static::$absentTypeInstance; + } + + return static::$absentTypeInstance = new static(static::ABSENT_TYPE_ID); + } + public function toDeclarationType() : string { if (static::STRING_TYPE_ID === $this->phpTypeId) { @@ -364,6 +382,10 @@ public function toDeclarationType() : string return '?static'; } + if (static::ABSENT_TYPE_ID === $this->phpTypeId) { + return ''; + } + throw new RuntimeException(__METHOD__." Died because ".__CLASS__." was misused."); } @@ -425,6 +447,10 @@ public function toAnnotationTypeString() : string return 'nullable static'; } + if (static::ABSENT_TYPE_ID === $this->phpTypeId) { + return ''; + } + throw new RuntimeException(__METHOD__." Died because ".__CLASS__." was misused."); } diff --git a/src/MetaCode/Format/ClassFormatter.php b/src/MetaCode/Format/ClassFormatter.php index 3d19616f..1c631bb7 100644 --- a/src/MetaCode/Format/ClassFormatter.php +++ b/src/MetaCode/Format/ClassFormatter.php @@ -191,12 +191,16 @@ private function formatProperties(ClassDefinition $classDefinition, int $depth): private function formatProperty(ClassDefinition $classDefinition, ClassPropertyDefinition $property, int $depth): string { + $typeHint = $this->shortenTypeHint($classDefinition, $property->getPhpTypeEnum()); + $statement = $this->getIndentation($depth) - . $property->getVisibilityEnum()->toReservedWord() - . ' ' - . $this->shortenTypeHint($classDefinition, $property->getPhpTypeEnum()) - . ' $' - . $property->getVariableName(); + . $property->getVisibilityEnum()->toReservedWord(); + + if (!empty($typeHint)) { + $statement .= ' ' . $typeHint; + } + + $statement .= ' $' . $property->getVariableName(); if ($property->hasValue()) { $statement .= ' = ' . var_export($property->getValue(), true); diff --git a/tests/Behat/Contexts/ModelGeneratorConfigurationContext.php b/tests/Behat/Contexts/ModelGeneratorConfigurationContext.php index 840e124c..7c8c3541 100644 --- a/tests/Behat/Contexts/ModelGeneratorConfigurationContext.php +++ b/tests/Behat/Contexts/ModelGeneratorConfigurationContext.php @@ -80,4 +80,12 @@ public function givenModelGeneratorConfigurationWithTraits($trait) { $this->getModelGeneratorConfiguration()->setTraits([$trait]); } + + /** + * @Given /^ModelGeneratorConfiguration has enabled the connection property$/ + */ + public function givenModelGeneratorConfigurationWithConnectionEnabled() + { + $this->getModelGeneratorConfiguration()->appendConnection(true); + } } \ No newline at end of file diff --git a/tests/Behat/Contexts/ModelGeneratorContext.php b/tests/Behat/Contexts/ModelGeneratorContext.php index 279b3be7..214b7ea5 100644 --- a/tests/Behat/Contexts/ModelGeneratorContext.php +++ b/tests/Behat/Contexts/ModelGeneratorContext.php @@ -160,4 +160,27 @@ public function lastAbstractModelClassDefinitionClassNameIs($className) "Abstract Model must be named [$className]" ); } + + /** + * @Then /^last Abstract Model ClassDefinition has Eloquent connection property with value "([^"]*)"$/ + */ + public function thenLastAbstractModelClassDefinitionHasEloquentConnectionPropertyWithValue($connectionName) + { + $classPropertyDefinitionContext = $this->classDefinitionContext + ->getLastAbstractClassDefinitionPropertyDefinitionContext(ModelGenerator::PROPERTY_CONNECTION); + + $classPropertyDefinitionContext->thenHasName( + ModelGenerator::PROPERTY_CONNECTION, + 'Eloquent Model property $connection must be present' + ); + + $classPropertyDefinitionContext->thenVisibilityIsProtected( + 'Eloquent Model property $connection must be private' + ); + + $classPropertyDefinitionContext->thenValueEquals( + $connectionName, + "Eloquent Model property \$connection must have value equals to [$connectionName]" + ); + } } \ No newline at end of file diff --git a/tests/Behat/Contexts/SchemaBlueprintContext.php b/tests/Behat/Contexts/SchemaBlueprintContext.php index e0c61ef4..c027233c 100644 --- a/tests/Behat/Contexts/SchemaBlueprintContext.php +++ b/tests/Behat/Contexts/SchemaBlueprintContext.php @@ -12,6 +12,8 @@ class SchemaBlueprintContext extends FeatureContext */ private array $schemaBlueprints = []; + private ?SchemaBlueprint $lastSchemaBlueprint = null; + /** * @param string $schemaName * @@ -26,7 +28,22 @@ public function getSchemaBlueprint(string $schemaName): SchemaBlueprint "\nTry adding 'the DatabaseBlueprint has SchemaBlueprint \"{$schemaName}\"' before this statement." ); - return $this->schemaBlueprints[$schemaName]; + return $this->lastSchemaBlueprint = $this->schemaBlueprints[$schemaName]; + } + + /** + * @return SchemaBlueprint + */ + public function getLastSchemaBlueprint(): SchemaBlueprint + { + Test::assertInstanceOf( + SchemaBlueprint::class, + $this->lastSchemaBlueprint, + "You tried to reference a previously initialized SchemaBlueprint, but none has been constructed.". + "\nTry adding 'the DatabaseBlueprint has SchemaBlueprint \"some_squema\"' before this statement." + ); + + return $this->lastSchemaBlueprint; } /** @@ -36,7 +53,8 @@ public function theDatabaseBlueprintHasSchemaBlueprint($schemaName) { $this->schemaBlueprints[$schemaName] = new SchemaBlueprint( $this->databaseBlueprintContext->getDatabaseBlueprint(), - $schemaName + $schemaName, + 'some_connection' ); } } diff --git a/tests/Behat/Contexts/TableBlueprintContext.php b/tests/Behat/Contexts/TableBlueprintContext.php index 01ca081a..0ecb21b3 100644 --- a/tests/Behat/Contexts/TableBlueprintContext.php +++ b/tests/Behat/Contexts/TableBlueprintContext.php @@ -58,6 +58,14 @@ public function givenSchemaBlueprintHasTableBlueprint(string $schemaName, string $this->lastTableBlueprint = $tableBlueprint; } + /** + * @Given /^last SchemaBlueprint is on connection "([^"]*)"$/ + */ + public function givenLastSchemaBlueprintIsOnConnection(string $connectionName) + { + $this->schemaBlueprintContext->getLastSchemaBlueprint()->setConnectionName($connectionName); + } + /** * @Given /^last TableBlueprint has identity ColumnBlueprint "([^"]*)"$/ */ diff --git a/tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/AppendConnection.feature b/tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/AppendConnection.feature new file mode 100644 index 00000000..df1bc461 --- /dev/null +++ b/tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/AppendConnection.feature @@ -0,0 +1,21 @@ +Feature: Append Connection + + Background: + Given a default ModelGeneratorConfiguration + And a default DatabaseBlueprintConfiguration + And a new DatabaseBlueprint + And the DatabaseBlueprint has SchemaBlueprint "sample" + + Scenario Outline: it appends the connection property to generated models + Given SchemaBlueprint "sample" has TableBlueprint "" + And last SchemaBlueprint is on connection "" + And ModelGeneratorConfiguration has enabled the connection property + And a ModelGenerator is created + When an Abstract Model ClassDefinition is generated + Then last Abstract Model ClassDefinition has Eloquent connection property with value "" + + Examples: + | table | connection | + | users | mysql | + | users | sqlite | + | users | testing | diff --git a/tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/AddTraits.feature b/tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/Traits.feature similarity index 100% rename from tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/AddTraits.feature rename to tests/Behat/Suites/Generator/Model/ClassDefinitionGeneration/Traits.feature diff --git a/tests/MetaCode/Format/ClassFormatterTest.php b/tests/MetaCode/Format/ClassFormatterTest.php index bc95336c..3d62bed9 100644 --- a/tests/MetaCode/Format/ClassFormatterTest.php +++ b/tests/MetaCode/Format/ClassFormatterTest.php @@ -299,6 +299,43 @@ class OneClass $this->assertEquals($expectedClassOutput, $classOutput); } + /** + * @test + */ + public function it_formats_a_class_with_one_property_with_an_absent_type() + { + $expectedClassOutput = +<<setValue(56); + + $classDefinition = new ClassDefinition('OneClass', '\OneNamespace'); + $classDefinition->addProperty($aProperty); + + $classFormatter = new ClassFormatter(); + + $classOutput = $classFormatter->format($classDefinition); + + $this->assertEquals($expectedClassOutput, $classOutput); + } + /** * @test */