Skip to content

Commit 015dbb6

Browse files
Improve test names
1 parent b3b44b4 commit 015dbb6

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

tests/ChunkTest.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,61 @@
1919
#[Small]
2020
final class ChunkTest extends TestCase
2121
{
22-
private Chunk $chunk;
23-
24-
protected function setUp(): void
22+
public function testHasLines(): void
2523
{
26-
$this->chunk = new Chunk;
24+
$this->assertEquals([$this->line()], $this->chunk()->lines());
25+
$this->assertEquals([$this->line()], $this->chunk()->getLines());
2726
}
2827

29-
public function testHasInitiallyNoLines(): void
28+
public function testHasStart(): void
3029
{
31-
$this->assertSame([], $this->chunk->lines());
32-
$this->assertSame([], $this->chunk->getLines());
30+
$this->assertSame(1, $this->chunk()->start());
31+
$this->assertSame(1, $this->chunk()->getStart());
3332
}
3433

35-
public function testCanBeCreatedWithoutArguments(): void
34+
public function testHasStartRange(): void
3635
{
37-
$this->assertInstanceOf(Chunk::class, $this->chunk);
36+
$this->assertSame(2, $this->chunk()->startRange());
37+
$this->assertSame(2, $this->chunk()->getStartRange());
3838
}
3939

40-
public function testStartCanBeRetrieved(): void
40+
public function testHasEnd(): void
4141
{
42-
$this->assertSame(0, $this->chunk->start());
43-
$this->assertSame(0, $this->chunk->getStart());
42+
$this->assertSame(3, $this->chunk()->end());
43+
$this->assertSame(3, $this->chunk()->getEnd());
4444
}
4545

46-
public function testStartRangeCanBeRetrieved(): void
46+
public function testHasEndRange(): void
4747
{
48-
$this->assertSame(1, $this->chunk->startRange());
49-
$this->assertSame(1, $this->chunk->getStartRange());
48+
$this->assertSame(4, $this->chunk()->endRange());
49+
$this->assertSame(4, $this->chunk()->getEndRange());
5050
}
5151

52-
public function testEndCanBeRetrieved(): void
52+
public function testLinesCanBeSet(): void
5353
{
54-
$this->assertSame(0, $this->chunk->end());
55-
$this->assertSame(0, $this->chunk->getEnd());
56-
}
54+
$chunk = $this->chunk();
55+
$lines = [new Line(Line::ADDED, 'added'), new Line(Line::REMOVED, 'removed')];
5756

58-
public function testEndRangeCanBeRetrieved(): void
59-
{
60-
$this->assertSame(1, $this->chunk->endRange());
61-
$this->assertSame(1, $this->chunk->getEndRange());
57+
$chunk->setLines($lines);
58+
59+
$this->assertSame($lines, $chunk->lines());
6260
}
6361

64-
public function testLinesCanBeRetrieved(): void
62+
private function chunk(): Chunk
6563
{
66-
$this->assertSame([], $this->chunk->lines());
67-
$this->assertSame([], $this->chunk->getLines());
64+
return new Chunk(
65+
1,
66+
2,
67+
3,
68+
4,
69+
[
70+
$this->line(),
71+
]
72+
);
6873
}
6974

70-
public function testLinesCanBeSet(): void
75+
private function line(): Line
7176
{
72-
$lines = [new Line(Line::ADDED, 'added'), new Line(Line::REMOVED, 'removed')];
73-
74-
$this->chunk->setLines($lines);
75-
76-
$this->assertSame($lines, $this->chunk->lines());
77-
$this->assertSame($lines, $this->chunk->getLines());
77+
return new Line(Line::ADDED, 'content');
7878
}
7979
}

0 commit comments

Comments
 (0)