Skip to content

Commit a193775

Browse files
committed
[TASK] Add a dedicated testcase for the abstract CSSBlockList
1 parent 5c193b9 commit a193775

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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\Renderable;
10+
use Sabberworm\CSS\Tests\Unit\CSSList\Fixtures\ConcreteCSSBlockList;
11+
12+
/**
13+
* @covers \Sabberworm\CSS\CSSList\CSSBlockList
14+
* @covers \Sabberworm\CSS\CSSList\CSSList
15+
*/
16+
final class CSSBlockListTest extends TestCase
17+
{
18+
/**
19+
* @test
20+
*/
21+
public function implementsRenderable(): void
22+
{
23+
$subject = new ConcreteCSSBlockList();
24+
25+
self::assertInstanceOf(Renderable::class, $subject);
26+
}
27+
28+
/**
29+
* @test
30+
*/
31+
public function implementsCommentable(): void
32+
{
33+
$subject = new ConcreteCSSBlockList();
34+
35+
self::assertInstanceOf(Commentable::class, $subject);
36+
}
37+
38+
/**
39+
* @test
40+
*/
41+
public function isCSSList(): void
42+
{
43+
$subject = new ConcreteCSSBlockList();
44+
45+
self::assertInstanceOf(ConcreteCSSBlockList::class, $subject);
46+
}
47+
}

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)