Skip to content

Commit 7e688fc

Browse files
authored
[TASK] Add more unit tests for Size (#1165)
Part of #757
1 parent a05cb3b commit 7e688fc

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

tests/Unit/Value/SizeTest.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,39 @@
77
use PHPUnit\Framework\TestCase;
88
use Sabberworm\CSS\Parsing\ParserState;
99
use Sabberworm\CSS\Settings;
10+
use Sabberworm\CSS\Value\PrimitiveValue;
1011
use Sabberworm\CSS\Value\Size;
12+
use Sabberworm\CSS\Value\Value;
1113

1214
/**
15+
* @covers \Sabberworm\CSS\Value\PrimitiveValue
1316
* @covers \Sabberworm\CSS\Value\Size
17+
* @covers \Sabberworm\CSS\Value\Value
1418
*/
1519
final class SizeTest extends TestCase
1620
{
1721
/**
18-
* @return array<string, array{0: string}>
22+
* @test
23+
*/
24+
public function isPrimitiveValue(): void
25+
{
26+
$subject = new Size(1);
27+
28+
self::assertInstanceOf(PrimitiveValue::class, $subject);
29+
}
30+
31+
/**
32+
* @test
33+
*/
34+
public function isValue(): void
35+
{
36+
$subject = new Size(1);
37+
38+
self::assertInstanceOf(Value::class, $subject);
39+
}
40+
41+
/**
42+
* @return array<string, array{0: non-empty-string}>
1943
*/
2044
public static function provideUnit(): array
2145
{
@@ -64,12 +88,14 @@ static function (string $unit): array {
6488
/**
6589
* @test
6690
*
91+
* @param non-empty-string $unit
92+
*
6793
* @dataProvider provideUnit
6894
*/
6995
public function parsesUnit(string $unit): void
7096
{
71-
$subject = Size::parse(new ParserState('1' . $unit, Settings::create()));
97+
$parsedSize = Size::parse(new ParserState('1' . $unit, Settings::create()));
7298

73-
self::assertSame($unit, $subject->getUnit());
99+
self::assertSame($unit, $parsedSize->getUnit());
74100
}
75101
}

0 commit comments

Comments
 (0)