Skip to content

Commit e27241d

Browse files
committed
Add more tests
1 parent a65ec6b commit e27241d

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Diff\Renderer\Text;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use jblond\Diff;
9+
use jblond\Diff\Renderer\Text\Json;
10+
11+
class JsonTest extends TestCase
12+
{
13+
public function testJsonRendererProducesValidJson()
14+
{
15+
$diff = new Diff("foo", "bar");
16+
$output = $diff->render(new Json());
17+
$decoded = json_decode($output, true);
18+
19+
$this->assertIsArray($decoded);
20+
$this->assertNotEmpty($decoded);
21+
$this->assertIsArray($decoded[0]);
22+
}
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Diff\Renderer\Text;
6+
7+
use jblond\Diff;
8+
use jblond\Diff\Renderer\Text\Unified;
9+
use PHPUnit\Framework\TestCase;
10+
11+
class UnifiedTest extends TestCase
12+
{
13+
public function testUnifiedRendererShowsChanges()
14+
{
15+
$diff = new Diff("foo", "bar");
16+
$output = $diff->render(new Unified());
17+
$this->assertStringContainsString("-foo", $output);
18+
$this->assertStringContainsString("+bar", $output);
19+
}
20+
}

0 commit comments

Comments
 (0)