diff --git a/src/Value/LineName.php b/src/Value/LineName.php index a2ec2bea..e0c1c11c 100644 --- a/src/Value/LineName.php +++ b/src/Value/LineName.php @@ -62,14 +62,4 @@ public function render(OutputFormat $outputFormat): string { return '[' . parent::render(OutputFormat::createCompact()) . ']'; } - - /** - * @return array|null> - * - * @internal - */ - public function getArrayRepresentation(): array - { - throw new \BadMethodCallException('`getArrayRepresentation` is not yet implemented for `' . self::class . '`'); - } } diff --git a/tests/Unit/Value/LineNameTest.php b/tests/Unit/Value/LineNameTest.php index e48670f8..65673005 100644 --- a/tests/Unit/Value/LineNameTest.php +++ b/tests/Unit/Value/LineNameTest.php @@ -17,12 +17,53 @@ final class LineNameTest extends TestCase /** * @test */ - public function getArrayRepresentationThrowsException(): void + public function getArrayRepresentationIncludesClassName(): void { - $this->expectException(\BadMethodCallException::class); + $subject = new LineName(); + + $result = $subject->getArrayRepresentation(); + + self::assertSame('LineName', $result['class']); + } + + /** + * @test + */ + public function getArrayRepresentationCanIncludeOneStringComponent(): void + { + $name = 'main-start'; + $subject = new LineName([$name]); + + $result = $subject->getArrayRepresentation(); + + self::assertSame($name, $result['components'][0]['value']); + } + + /** + * @test + */ + public function getArrayRepresentationCanIncludeMultipleStringComponents(): void + { + $name1 = 'main-start'; + $name2 = 'main-end'; + $subject = new LineName([$name1, $name2]); + + $result = $subject->getArrayRepresentation(); + + self::assertSame($name1, $result['components'][0]['value']); + self::assertSame($name2, $result['components'][1]['value']); + } + + /** + * @test + */ + public function getArrayRepresentationIncludesSpaceSeparator(): void + { $subject = new LineName(); - $subject->getArrayRepresentation(); + $result = $subject->getArrayRepresentation(); + + self::assertSame(' ', $result['separator']); } }