|
10 | 10 | namespace SebastianBergmann\Diff;
|
11 | 11 |
|
12 | 12 | use PHPUnit\Framework\Attributes\CoversClass;
|
| 13 | +use PHPUnit\Framework\Attributes\Small; |
13 | 14 | use PHPUnit\Framework\TestCase;
|
14 | 15 |
|
15 | 16 | #[CoversClass(Line::class)]
|
| 17 | +#[Small] |
16 | 18 | final class LineTest extends TestCase
|
17 | 19 | {
|
18 |
| - private Line $line; |
| 20 | + public function testCanBeOfTypeAdded(): void |
| 21 | + { |
| 22 | + $this->assertSame(Line::ADDED, $this->added()->type()); |
| 23 | + $this->assertSame(Line::ADDED, $this->added()->getType()); |
| 24 | + |
| 25 | + $this->assertTrue($this->added()->isAdded()); |
| 26 | + $this->assertFalse($this->added()->isRemoved()); |
| 27 | + $this->assertFalse($this->added()->isUnchanged()); |
| 28 | + } |
| 29 | + |
| 30 | + public function testCanBeOfTypeRemoved(): void |
| 31 | + { |
| 32 | + $this->assertSame(Line::REMOVED, $this->removed()->type()); |
| 33 | + $this->assertSame(Line::REMOVED, $this->removed()->getType()); |
| 34 | + |
| 35 | + $this->assertTrue($this->removed()->isRemoved()); |
| 36 | + $this->assertFalse($this->removed()->isAdded()); |
| 37 | + $this->assertFalse($this->removed()->isUnchanged()); |
| 38 | + } |
| 39 | + |
| 40 | + public function testCanBeOfTypeUnchanged(): void |
| 41 | + { |
| 42 | + $this->assertSame(Line::UNCHANGED, $this->unchanged()->type()); |
| 43 | + $this->assertSame(Line::UNCHANGED, $this->unchanged()->getType()); |
| 44 | + |
| 45 | + $this->assertTrue($this->unchanged()->isUnchanged()); |
| 46 | + $this->assertFalse($this->unchanged()->isAdded()); |
| 47 | + $this->assertFalse($this->unchanged()->isRemoved()); |
| 48 | + } |
19 | 49 |
|
20 |
| - protected function setUp(): void |
| 50 | + public function testHasContent(): void |
21 | 51 | {
|
22 |
| - $this->line = new Line; |
| 52 | + $this->assertSame('content', $this->added()->content()); |
| 53 | + $this->assertSame('content', $this->added()->getContent()); |
23 | 54 | }
|
24 | 55 |
|
25 |
| - public function testCanBeCreatedWithoutArguments(): void |
| 56 | + private function added(): Line |
26 | 57 | {
|
27 |
| - $this->assertInstanceOf(Line::class, $this->line); |
| 58 | + return new Line(Line::ADDED, 'content'); |
28 | 59 | }
|
29 | 60 |
|
30 |
| - public function testTypeCanBeRetrieved(): void |
| 61 | + private function removed(): Line |
31 | 62 | {
|
32 |
| - $this->assertSame(Line::UNCHANGED, $this->line->type()); |
33 |
| - $this->assertSame(Line::UNCHANGED, $this->line->getType()); |
| 63 | + return new Line(Line::REMOVED, 'content'); |
34 | 64 | }
|
35 | 65 |
|
36 |
| - public function testContentCanBeRetrieved(): void |
| 66 | + private function unchanged(): Line |
37 | 67 | {
|
38 |
| - $this->assertSame('', $this->line->content()); |
39 |
| - $this->assertSame('', $this->line->getContent()); |
| 68 | + return new Line(Line::UNCHANGED, 'content'); |
40 | 69 | }
|
41 | 70 | }
|
0 commit comments