From 4fc3208723ac60116567c640847a86e32bd69d1b Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sat, 15 Feb 2025 13:28:34 +0100 Subject: [PATCH 1/2] [TASK] Add some more unit tests for `AtRuleBlockList` Part of #757 --- tests/Unit/CSSList/AtRuleBlockListTest.php | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/Unit/CSSList/AtRuleBlockListTest.php b/tests/Unit/CSSList/AtRuleBlockListTest.php index b57e0525..3fd2f757 100644 --- a/tests/Unit/CSSList/AtRuleBlockListTest.php +++ b/tests/Unit/CSSList/AtRuleBlockListTest.php @@ -11,6 +11,8 @@ /** * @covers \Sabberworm\CSS\CSSList\AtRuleBlockList + * @covers \Sabberworm\CSS\CSSList\CSSBlockList + * @covers \Sabberworm\CSS\CSSList\CSSList */ final class AtRuleBlockListTest extends TestCase { @@ -43,4 +45,70 @@ public function implementsCommentable(): void self::assertInstanceOf(Commentable::class, $subject); } + + /** + * @test + */ + public function atRuleNameReturnsTypeProvidedToConstructor(): void + { + $type = 'foo'; + + $subject = new AtRuleBlockList($type); + + self::assertSame($type, $subject->atRuleName()); + } + + /** + * @test + */ + public function getLineNoByDefaultReturnsZero(): void + { + $subject = new AtRuleBlockList(''); + + self::assertSame(0, $subject->getLineNo()); + } + + /** + * @test + */ + public function atRuleArgsByDefaultReturnsEmptyString(): void + { + $subject = new AtRuleBlockList(''); + + self::assertSame('', $subject->atRuleArgs()); + } + + /** + * @test + */ + public function atRuleArgusReturnsArgumentsProvidedToConstructor(): void + { + $arguments = 'bar'; + + $subject = new AtRuleBlockList('', $arguments); + + self::assertSame($arguments, $subject->atRuleArgs()); + } + + /** + * @test + */ + public function getLineNoReturnsLineNumberProvidedToConstructor(): void + { + $lineNumber = 42; + + $subject = new AtRuleBlockList('', '', $lineNumber); + + self::assertSame($lineNumber, $subject->getLineNo()); + } + + /** + * @test + */ + public function isRootListAlwaysReturnsFalse(): void + { + $subject = new AtRuleBlockList(''); + + self::assertFalse($subject->isRootList()); + } } From f21229364d436c49438c2640d22172188424c24f Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 16 Feb 2025 10:18:41 +0100 Subject: [PATCH 2/2] Fix typo Co-authored-by: JakeQZ --- tests/Unit/CSSList/AtRuleBlockListTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/CSSList/AtRuleBlockListTest.php b/tests/Unit/CSSList/AtRuleBlockListTest.php index 3fd2f757..30a7f305 100644 --- a/tests/Unit/CSSList/AtRuleBlockListTest.php +++ b/tests/Unit/CSSList/AtRuleBlockListTest.php @@ -81,7 +81,7 @@ public function atRuleArgsByDefaultReturnsEmptyString(): void /** * @test */ - public function atRuleArgusReturnsArgumentsProvidedToConstructor(): void + public function atRuleArgsReturnsArgumentsProvidedToConstructor(): void { $arguments = 'bar';