-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathPositionTest.php
More file actions
91 lines (75 loc) · 1.85 KB
/
Copy pathPositionTest.php
File metadata and controls
91 lines (75 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
declare(strict_types=1);
namespace Sabberworm\CSS\Tests\UnitDeprecated\Position;
use PHPUnit\Framework\TestCase;
use Sabberworm\CSS\Tests\Unit\Position\Fixtures\ConcretePosition;
/**
* @covers \Sabberworm\CSS\Position\Position
*/
final class PositionTest extends TestCase
{
/**
* @var ConcretePosition
*/
private $subject;
protected function setUp(): void
{
$this->subject = new ConcretePosition();
}
/**
* @return array<non-empty-string, array{0: int<1, max>}>
*/
public function provideLineNumber(): array
{
return [
'line 1' => [1],
'line 42' => [42],
];
}
/**
* @return array<non-empty-string, array{0: int<0, max>}>
*/
public function provideColumnNumber(): array
{
return [
'column 0' => [0],
'column 14' => [14],
'column 39' => [39],
];
}
/**
* @test
*/
public function getLineNoInitiallyReturnsZero(): void
{
self::assertSame(0, $this->subject->getLineNo());
}
/**
* @test
*
* @dataProvider provideLineNumber
*/
public function getLineNoReturnsLineNumberSet(int $lineNumber): void
{
$this->subject->setPosition($lineNumber);
self::assertSame($lineNumber, $this->subject->getLineNo());
}
/**
* @test
*/
public function getLineNoReturnsZeroAfterLineNumberCleared(): void
{
$this->subject->setPosition(99);
$this->subject->setPosition(null);
self::assertSame(0, $this->subject->getLineNo());
}
/**
* @test
*/
public function getLineNoAfterSetPositionWithZeroReturnsZero(): void
{
$this->subject->setPosition(99);
$this->subject->setPosition(0);
self::assertSame(0, $this->subject->getLineNo());
}
}