File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313use Sabberworm \CSS \Property \Selector \CompoundSelector ;
1414use Sabberworm \CSS \Property \Selector \SpecificityCalculator ;
1515use Sabberworm \CSS \Renderable ;
16+ use Sabberworm \CSS \ShortClassNameProvider ;
1617
1718use function Safe \preg_match ;
1819use function Safe \preg_replace ;
2324 */
2425class Selector implements Renderable
2526{
27+ use ShortClassNameProvider;
28+
2629 /**
2730 * @internal since 8.5.2
2831 */
@@ -192,6 +195,8 @@ public function render(OutputFormat $outputFormat): string
192195 */
193196 public function getArrayRepresentation (): array
194197 {
195- throw new \BadMethodCallException ('`getArrayRepresentation` is not yet implemented for ` ' . self ::class . '` ' );
198+ return [
199+ 'class ' => $ this ->getShortClassName (),
200+ ];
196201 }
197202}
Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ final class KeyframeSelectorTest extends TestCase
1616 /**
1717 * @test
1818 */
19- public function getArrayRepresentationThrowsException (): void
19+ public function getArrayRepresentationIncludesClassName (): void
2020 {
21- $ this -> expectException (\BadMethodCallException::class );
21+ $ subject = new KeyframeSelector ( '' );
2222
23- $ subject = new KeyframeSelector ( ' a ' );
23+ $ result = $ subject -> getArrayRepresentation ( );
2424
25- $ subject -> getArrayRepresentation ( );
25+ self :: assertSame ( ' KeyframeSelector ' , $ result [ ' class ' ] );
2626 }
2727}
Original file line number Diff line number Diff line change @@ -458,12 +458,12 @@ public function doesNotCleanupSpacesWithinAttributeSelector(): void
458458 /**
459459 * @test
460460 */
461- public function getArrayRepresentationThrowsException (): void
461+ public function getArrayRepresentationIncludesClassName (): void
462462 {
463- $ this -> expectException (\BadMethodCallException::class );
463+ $ subject = new Selector ( '' );
464464
465- $ subject = new Selector ( ' a ' );
465+ $ result = $ subject -> getArrayRepresentation ( );
466466
467- $ subject -> getArrayRepresentation ( );
467+ self :: assertSame ( ' Selector ' , $ result [ ' class ' ] );
468468 }
469469}
You can’t perform that action at this time.
0 commit comments