Skip to content

Commit f687f11

Browse files
committed
[TASK] Add tests for DeclarationBlock constructor
The class extends `RuleSet`, but the constructor behaviour needs to be tested for each class.
1 parent ac31718 commit f687f11

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/Unit/RuleSet/DeclarationBlockTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,43 @@ public function implementsPositionable(): void
5353
self::assertInstanceOf(Positionable::class, $this->subject);
5454
}
5555

56+
/**
57+
* @test
58+
*/
59+
public function getLineNumberByDefaultReturnsNull(): void
60+
{
61+
$result = $this->subject->getLineNumber();
62+
63+
self::assertNull($result);
64+
}
65+
66+
/**
67+
* @return array<non-empty-string, array{0: int<1, max>}>
68+
*/
69+
public function provideLineNumber(): array
70+
{
71+
return [
72+
'line 1' => [1],
73+
'line 42' => [42],
74+
];
75+
}
76+
77+
/**
78+
* @test
79+
*
80+
* @param int<1, max> $lineNumber
81+
*
82+
* @dataProvider provideLineNumber
83+
*/
84+
public function getLineNumberReturnsLineNumberPassedToConstructor(int $lineNumber): void
85+
{
86+
$subject = new DeclarationBlock($lineNumber);
87+
88+
$result = $subject->getLineNumber();
89+
90+
self::assertSame($lineNumber, $result);
91+
}
92+
5693
/**
5794
* @return array<non-empty-string, array{0: non-empty-string}>
5895
*/

0 commit comments

Comments
 (0)