Skip to content

Commit c59962b

Browse files
Add tests
1 parent a0f5f36 commit c59962b

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

tests/ChunkTest.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/*
3+
* This file is part of sebastian/diff.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace SebastianBergmann\Diff;
12+
13+
use PHPUnit\Framework\TestCase;
14+
15+
/**
16+
* @covers SebastianBergmann\Diff\Chunk
17+
*/
18+
class ChunkTest extends TestCase
19+
{
20+
/**
21+
* @var Chunk
22+
*/
23+
private $chunk;
24+
25+
protected function setUp()
26+
{
27+
$this->chunk = new Chunk;
28+
}
29+
30+
public function testCanBeCreatedWithoutArguments()
31+
{
32+
$this->assertInstanceOf(Chunk::class, $this->chunk);
33+
}
34+
35+
public function testStartCanBeRetrieved()
36+
{
37+
$this->assertEquals(0, $this->chunk->getStart());
38+
}
39+
40+
public function testStartRangeCanBeRetrieved()
41+
{
42+
$this->assertEquals(1, $this->chunk->getStartRange());
43+
}
44+
45+
public function testEndCanBeRetrieved()
46+
{
47+
$this->assertEquals(0, $this->chunk->getEnd());
48+
}
49+
50+
public function testEndRangeCanBeRetrieved()
51+
{
52+
$this->assertEquals(1, $this->chunk->getEndRange());
53+
}
54+
55+
public function testLinesCanBeRetrieved()
56+
{
57+
$this->assertEquals(array(), $this->chunk->getLines());
58+
}
59+
}

tests/LineTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* This file is part of sebastian/diff.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace SebastianBergmann\Diff;
12+
13+
use PHPUnit\Framework\TestCase;
14+
15+
/**
16+
* @covers SebastianBergmann\Diff\Line
17+
*/
18+
class LineTest extends TestCase
19+
{
20+
/**
21+
* @var Line
22+
*/
23+
private $line;
24+
25+
protected function setUp()
26+
{
27+
$this->line = new Line;
28+
}
29+
30+
public function testCanBeCreatedWithoutArguments()
31+
{
32+
$this->assertInstanceOf(Line::class, $this->line);
33+
}
34+
35+
public function testTypeCanBeRetrieved()
36+
{
37+
$this->assertEquals(Line::UNCHANGED, $this->line->getType());
38+
}
39+
40+
public function testContentCanBeRetrieved()
41+
{
42+
$this->assertEquals('', $this->line->getContent());
43+
}
44+
}

0 commit comments

Comments
 (0)