55namespace Sabberworm \CSS \Tests \Unit \Value ;
66
77use PHPUnit \Framework \TestCase ;
8- use Sabberworm \CSS \Value \RuleValueList ;
8+ use Sabberworm \CSS \Tests \Unit \Value \Fixtures \ConcreteRuleValueList ;
9+ use Sabberworm \CSS \Value \Size ;
910
1011/**
1112 * @covers \Sabberworm\CSS\Value\RuleValueList
@@ -19,10 +20,66 @@ final class RuleValueListTest extends TestCase
1920 */
2021 public function getArrayRepresentationIncludesClassName (): void
2122 {
22- $ subject = new RuleValueList ();
23+ $ subject = new ConcreteRuleValueList ();
2324
2425 $ result = $ subject ->getArrayRepresentation ();
2526
26- self ::assertSame ('RuleValueList ' , $ result ['class ' ]);
27+ self ::assertSame ('ConcreteRuleValueList ' , $ result ['class ' ]);
28+ }
29+
30+ /**
31+ * @test
32+ */
33+ public function getArrayRepresentationIncludesStringComponent (): void
34+ {
35+ $ subject = new ConcreteRuleValueList ();
36+ $ subject ->addListComponent ('Helvetica ' );
37+
38+ $ result = $ subject ->getArrayRepresentation ();
39+
40+ self ::assertSame ('Helvetica ' , $ result ['components ' ][0 ]['value ' ]);
41+ }
42+
43+ /**
44+ * @test
45+ */
46+ public function getArrayRepresentationIncludesValueComponent (): void
47+ {
48+ $ subject = new ConcreteRuleValueList ();
49+ $ subject ->addListComponent (new Size (1 ));
50+
51+ $ result = $ subject ->getArrayRepresentation ();
52+
53+ self ::assertSame ('Size ' , $ result ['components ' ][0 ]['class ' ]);
54+ }
55+
56+ /**
57+ * @test
58+ */
59+ public function getArrayRepresentationIncludesMultipleMixedComponents (): void
60+ {
61+ $ subject = new ConcreteRuleValueList ();
62+ $ subject ->addListComponent (new Size (1 ));
63+ $ subject ->addListComponent ('+ ' );
64+ $ subject ->addListComponent (new Size (2 ));
65+
66+ $ result = $ subject ->getArrayRepresentation ();
67+
68+ self ::assertSame ('Size ' , $ result ['components ' ][0 ]['class ' ]);
69+ self ::assertSame ('+ ' , $ result ['components ' ][1 ]['value ' ]);
70+ self ::assertSame ('Size ' , $ result ['components ' ][2 ]['class ' ]);
71+ }
72+
73+ /**
74+ * @test
75+ */
76+ public function getArrayRepresentationIncludesSeparator (): void
77+ {
78+ $ separator = ', ' ;
79+ $ subject = new ConcreteRuleValueList ($ separator );
80+
81+ $ result = $ subject ->getArrayRepresentation ();
82+
83+ self ::assertSame ($ separator , $ result ['separator ' ]);
2784 }
2885}
0 commit comments