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
10 changes: 0 additions & 10 deletions src/Value/LineName.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,4 @@ public function render(OutputFormat $outputFormat): string
{
return '[' . parent::render(OutputFormat::createCompact()) . ']';
}

/**
* @return array<string, bool|int|float|string|array<mixed>|null>
*
* @internal
*/
public function getArrayRepresentation(): array
{
throw new \BadMethodCallException('`getArrayRepresentation` is not yet implemented for `' . self::class . '`');
}
}
47 changes: 44 additions & 3 deletions tests/Unit/Value/LineNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}