Skip to content

Commit ac31718

Browse files
authored
[TASK] Add tests for RuleSet constructor (#1348)
1 parent bb3d342 commit ac31718

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/Unit/RuleSet/RuleSetTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,41 @@ public function implementsCSSListItem(): void
4141
{
4242
self::assertInstanceOf(CSSListItem::class, $this->subject);
4343
}
44+
45+
/**
46+
* @test
47+
*/
48+
public function getLineNumberByDefaultReturnsNull(): void
49+
{
50+
$result = $this->subject->getLineNumber();
51+
52+
self::assertNull($result);
53+
}
54+
55+
/**
56+
* @return array<non-empty-string, array{0: int<1, max>}>
57+
*/
58+
public function provideLineNumber(): array
59+
{
60+
return [
61+
'line 1' => [1],
62+
'line 42' => [42],
63+
];
64+
}
65+
66+
/**
67+
* @test
68+
*
69+
* @param int<1, max> $lineNumber
70+
*
71+
* @dataProvider provideLineNumber
72+
*/
73+
public function getLineNumberReturnsLineNumberPassedToConstructor(int $lineNumber): void
74+
{
75+
$subject = new RuleSet($lineNumber);
76+
77+
$result = $subject->getLineNumber();
78+
79+
self::assertSame($result, $subject->getLineNumber());
80+
}
4481
}

0 commit comments

Comments
 (0)