Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
Extracted multibyte tests to their own file
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddanbrown committed Jan 24, 2022
1 parent 3c5df7f commit 40d1a8a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
10 changes: 0 additions & 10 deletions tests/HtmlDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ public function test_it_should_change_a_letter()
$this->assertEquals('a <del class="diffmod">b</del><ins class="diffmod">d</ins> c', $output);
}

public function test_it_should_support_chinese()
{
$output = Diff::excecute('这个是中文内容, PHP is the bast', '这是中国语内容,PHP is the best language.');
$this->assertEquals('这<del class="diffdel">个</del>是中<del class="diffmod">文</del><ins class="diffmod">国语</ins>内容<del class="diffmod">, </del><ins class="diffmod">,</ins>PHP is the <del class="diffmod">bast</del><ins class="diffmod">best language.</ins>', $output);
}

public function test_space_changes_around_multibyte_characters()
{
$output = Diff::excecute('test測試', 'test 測試');
$this->assertEquals('<del class="diffmod">test測</del><ins class="diffmod">test 測</ins>試', $output);
}

public function test_it_should_support_img_tags_insertion()
{
Expand Down
19 changes: 19 additions & 0 deletions tests/MultiByteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php namespace Ssddanbrown\HtmlDiff\Tests;

use PHPUnit\Framework\TestCase;
use Ssddanbrown\HtmlDiff\Diff;

class MultiByteTest extends TestCase
{
public function test_chinese_content_support()
{
$output = Diff::excecute('这个是中文内容, PHP is the bast', '这是中国语内容,PHP is the best language.');
$this->assertEquals('这<del class="diffdel">个</del>是中<del class="diffmod">文</del><ins class="diffmod">国语</ins>内容<del class="diffmod">, </del><ins class="diffmod">,</ins>PHP is the <del class="diffmod">bast</del><ins class="diffmod">best language.</ins>', $output);
}

public function test_space_changes_around_multibyte_characters()
{
$output = Diff::excecute('test測試', 'test 測試');
$this->assertEquals('<del class="diffmod">test測</del><ins class="diffmod">test 測</ins>試', $output);
}
}

0 comments on commit 40d1a8a

Please sign in to comment.