Skip to content

Commit afdd72f

Browse files
authored
[TASK] Add a dedicated testcase for the abstract CSSBlockList (#984)
1 parent 5c193b9 commit afdd72f

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

tests/Unit/CSSList/AtRuleBlockListTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PHPUnit\Framework\TestCase;
88
use Sabberworm\CSS\Comment\Commentable;
99
use Sabberworm\CSS\CSSList\AtRuleBlockList;
10+
use Sabberworm\CSS\CSSList\CSSBlockList;
1011
use Sabberworm\CSS\CSSList\CSSList;
1112
use Sabberworm\CSS\Renderable;
1213

@@ -51,6 +52,16 @@ public function implementsCommentable(): void
5152
self::assertInstanceOf(Commentable::class, $subject);
5253
}
5354

55+
/**
56+
* @test
57+
*/
58+
public function isCSSBLockList(): void
59+
{
60+
$subject = new AtRuleBlockList('supports');
61+
62+
self::assertInstanceOf(CSSBlockList::class, $subject);
63+
}
64+
5465
/**
5566
* @test
5667
*/
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit\CSSList;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\Comment\Commentable;
9+
use Sabberworm\CSS\CSSList\CSSList;
10+
use Sabberworm\CSS\Renderable;
11+
use Sabberworm\CSS\Tests\Unit\CSSList\Fixtures\ConcreteCSSBlockList;
12+
13+
/**
14+
* @covers \Sabberworm\CSS\CSSList\CSSBlockList
15+
* @covers \Sabberworm\CSS\CSSList\CSSList
16+
*/
17+
final class CSSBlockListTest extends TestCase
18+
{
19+
/**
20+
* @test
21+
*/
22+
public function implementsRenderable(): void
23+
{
24+
$subject = new ConcreteCSSBlockList();
25+
26+
self::assertInstanceOf(Renderable::class, $subject);
27+
}
28+
29+
/**
30+
* @test
31+
*/
32+
public function implementsCommentable(): void
33+
{
34+
$subject = new ConcreteCSSBlockList();
35+
36+
self::assertInstanceOf(Commentable::class, $subject);
37+
}
38+
39+
/**
40+
* @test
41+
*/
42+
public function isCSSList(): void
43+
{
44+
$subject = new ConcreteCSSBlockList();
45+
46+
self::assertInstanceOf(CSSList::class, $subject);
47+
}
48+
}

tests/Unit/CSSList/DocumentTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PHPUnit\Framework\TestCase;
88
use Sabberworm\CSS\Comment\Commentable;
99
use Sabberworm\CSS\CSSList\AtRuleBlockList;
10+
use Sabberworm\CSS\CSSList\CSSBlockList;
1011
use Sabberworm\CSS\CSSList\CSSList;
1112
use Sabberworm\CSS\CSSList\Document;
1213
use Sabberworm\CSS\Property\Charset;
@@ -43,6 +44,16 @@ public function implementsCommentable(): void
4344
self::assertInstanceOf(Commentable::class, new Document());
4445
}
4546

47+
/**
48+
* @test
49+
*/
50+
public function isCSSBlockList(): void
51+
{
52+
$subject = new Document();
53+
54+
self::assertInstanceOf(CSSBlockList::class, $subject);
55+
}
56+
4657
/**
4758
* @test
4859
*/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit\CSSList\Fixtures;
6+
7+
use Sabberworm\CSS\CSSList\CSSBlockList;
8+
use Sabberworm\CSS\OutputFormat;
9+
10+
final class ConcreteCSSBlockList extends CSSBlockList
11+
{
12+
public function isRootList(): bool
13+
{
14+
throw new \BadMethodCallException('Not implemented', 1740395831);
15+
}
16+
17+
public function render(OutputFormat $outputFormat): string
18+
{
19+
throw new \BadMethodCallException('Not implemented', 1740395836);
20+
}
21+
}

0 commit comments

Comments
 (0)