Skip to content

Commit 9682877

Browse files
authored
[TASK] Add some more unit tests for AtRuleBlockList (#934)
Part of #757
1 parent 6775b97 commit 9682877

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/Unit/CSSList/AtRuleBlockListTest.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
/**
1313
* @covers \Sabberworm\CSS\CSSList\AtRuleBlockList
14+
* @covers \Sabberworm\CSS\CSSList\CSSBlockList
15+
* @covers \Sabberworm\CSS\CSSList\CSSList
1416
*/
1517
final class AtRuleBlockListTest extends TestCase
1618
{
@@ -43,4 +45,70 @@ public function implementsCommentable(): void
4345

4446
self::assertInstanceOf(Commentable::class, $subject);
4547
}
48+
49+
/**
50+
* @test
51+
*/
52+
public function atRuleNameReturnsTypeProvidedToConstructor(): void
53+
{
54+
$type = 'foo';
55+
56+
$subject = new AtRuleBlockList($type);
57+
58+
self::assertSame($type, $subject->atRuleName());
59+
}
60+
61+
/**
62+
* @test
63+
*/
64+
public function getLineNoByDefaultReturnsZero(): void
65+
{
66+
$subject = new AtRuleBlockList('');
67+
68+
self::assertSame(0, $subject->getLineNo());
69+
}
70+
71+
/**
72+
* @test
73+
*/
74+
public function atRuleArgsByDefaultReturnsEmptyString(): void
75+
{
76+
$subject = new AtRuleBlockList('');
77+
78+
self::assertSame('', $subject->atRuleArgs());
79+
}
80+
81+
/**
82+
* @test
83+
*/
84+
public function atRuleArgsReturnsArgumentsProvidedToConstructor(): void
85+
{
86+
$arguments = 'bar';
87+
88+
$subject = new AtRuleBlockList('', $arguments);
89+
90+
self::assertSame($arguments, $subject->atRuleArgs());
91+
}
92+
93+
/**
94+
* @test
95+
*/
96+
public function getLineNoReturnsLineNumberProvidedToConstructor(): void
97+
{
98+
$lineNumber = 42;
99+
100+
$subject = new AtRuleBlockList('', '', $lineNumber);
101+
102+
self::assertSame($lineNumber, $subject->getLineNo());
103+
}
104+
105+
/**
106+
* @test
107+
*/
108+
public function isRootListAlwaysReturnsFalse(): void
109+
{
110+
$subject = new AtRuleBlockList('');
111+
112+
self::assertFalse($subject->isRootList());
113+
}
46114
}

0 commit comments

Comments
 (0)