Passage en Namespace et tous les tests fonctionnels OK

This commit is contained in:
2021-05-10 11:48:15 +02:00
parent 536dd0d56b
commit eb30d8ef97
56 changed files with 1091 additions and 964 deletions

View File

@@ -7,6 +7,8 @@
namespace Domframework\Tests;
use Domframework\Xdiff;
/** Test the domframework xdiff part */
class xdiffTest extends \PHPUnit_Framework_TestCase
{
@@ -72,7 +74,7 @@ to this document.
public function test_diff_normal_1 ()
{
// Mode normal
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ($this->string1, $this->string2);
$this->assertSame ($res, "0a1,6
> This is an important
@@ -102,7 +104,7 @@ to this document.
public function test_diff_normal_2 ()
{
// Mode normal
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("NEWLINE\n".$this->string1, $this->string2);
$this->assertSame ($res, "1c1,6
< NEWLINE
@@ -134,7 +136,7 @@ to this document.
public function test_diff_normal_3 ()
{
// Mode normal
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("NEWLINE\n", "\n");
$this->assertSame ($res, "1c1
< NEWLINE
@@ -146,7 +148,7 @@ to this document.
public function test_diff_normal_4 ()
{
// Mode normal
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("\n", "NEWLINE\n");
$this->assertSame ($res, "1c1
<
@@ -157,14 +159,14 @@ to this document.
public function test_diff_normal_5 ()
{
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("\n", "\n");
$this->assertSame ($res, "");
}
public function test_diff_normal_6 ()
{
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("\n", "");
$this->assertSame ($res, "1d0
< \n");
@@ -172,7 +174,7 @@ to this document.
public function test_diff_normal_7 ()
{
$xdiff = new xdiff ();
$xdiff = new Xdiff ();
$res = $xdiff->diff ("", "\n");
$this->assertSame ($res, "0a1
> \n");
@@ -181,7 +183,7 @@ to this document.
public function test_diff_unified_1 ()
{
// Mode unified
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ($this->string1, $this->string2);
$date = date ("Y-m-d H:i:s.u00");
// DST must answer +0200 in winter and +0100 in summer
@@ -215,7 +217,7 @@ to this document.
public function test_diff_unified_2 ()
{
// Mode unified
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("NEWLINE\n".$this->string1, $this->string2);
$this->assertSame ($res, "--- Original ".date ("Y-m-d H:i:s.u000 O")."
+++ New ".date ("Y-m-d H:i:s.u001 O")."
@@ -246,7 +248,7 @@ to this document.
public function test_diff_unified_3 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("NEWLINE\n", "\n");
$this->assertSame ($res, "--- Original ".date ("Y-m-d H:i:s.u000 O")."
+++ New ".date ("Y-m-d H:i:s.u001 O")."
@@ -258,7 +260,7 @@ to this document.
public function test_diff_unified_4 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("\n", "NEWLINE\n");
$this->assertSame ($res, "--- Original ".date ("Y-m-d H:i:s.u000 O")."
+++ New ".date ("Y-m-d H:i:s.u001 O")."
@@ -270,14 +272,14 @@ to this document.
public function test_diff_unified_5 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("\n", "\n");
$this->assertSame ($res, "");
}
public function test_diff_unified_6 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("\n", "");
$this->assertSame ($res, "--- Original ".date ("Y-m-d H:i:s.u000 O")."
+++ New ".date ("Y-m-d H:i:s.u001 O")."
@@ -287,7 +289,7 @@ to this document.
public function test_diff_unified_7 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diff ("", "\n");
$this->assertSame ($res, "--- Original ".date ("Y-m-d H:i:s.u000 O")."
+++ New ".date ("Y-m-d H:i:s.u001 O")."
@@ -299,7 +301,7 @@ to this document.
{
file_put_contents ("/tmp/test_xdiff1", $this->string1);
file_put_contents ("/tmp/test_xdiff2", $this->string2);
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$res = $xdiff->diffFile ("/tmp/test_xdiff1", "/tmp/test_xdiff2");
$this->assertSame ($res, "--- /tmp/test_xdiff1 ".date ("Y-m-d H:i:s.u000 O")."
+++ /tmp/test_xdiff2 ".date ("Y-m-d H:i:s.u001 O")."
@@ -330,14 +332,14 @@ to this document.
public function test_diffFile_unified_2 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$this->setExpectedException ();
$res = $xdiff->diffFile ("/tmp/test_xdiffNOTEXISTS", "/tmp/test_xdiff2");
}
public function test_diffFile_unified_3 ()
{
$xdiff = new xdiff ("unified");
$xdiff = new Xdiff ("unified");
$this->setExpectedException ();
$res = $xdiff->diffFile ("/tmp/test_xdiff1", "/tmp/test_xdiffNOTEXISTS");
}
@@ -346,7 +348,7 @@ to this document.
{
file_put_contents ("/tmp/test_xdiff1", $this->string1);
file_put_contents ("/tmp/test_xdiff2", $this->string2);
$xdiff = new xdiff ("sideBySide");
$xdiff = new Xdiff ("sideBySide");
$res = $xdiff->diffFile ("/tmp/test_xdiff1", "/tmp/test_xdiff2");
$this->assertSame ($res,
" > This is an important