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,19 +7,21 @@
namespace Domframework\Tests;
/** Test the outputjson.php file */
class inifileTest extends \PHPUnit_Framework_TestCase
use Domframework\Inifile;
/** Test the Inifile.php file */
class InifileTest extends \PHPUnit_Framework_TestCase
{
public function testsetString001 ()
{
$this->setExpectedException ("Exception");
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (1, TRUE);
}
public function testsetString002 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array (), TRUE);
$this->assertSame("", $res);
}
@@ -28,41 +30,41 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString103 ()
{
$this->setExpectedException ("Exception");
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"), TRUE);
}
public function testsetString104 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array ()), TRUE);
$this->assertSame("[section1]\n\n", $res);
}
public function testsetString105 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0)), TRUE);
$this->assertSame("[section1]\n0 = \"0\"\n\n", $res);
}
public function testsetString106 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>1)), TRUE);
$this->assertSame("[section1]\n0 = \"1\"\n\n", $res);
}
public function testsetString107 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null)), TRUE);
$this->assertSame("[section1]\n0 = \"null\"\n\n", $res);
}
public function testsetString108 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null, 1=>1)),
TRUE);
$this->assertSame("[section1]\n0 = \"null\"\n1 = \"1\"\n\n", $res);
@@ -70,7 +72,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString109 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str")),
TRUE);
@@ -80,7 +82,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString110 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str",
3=>array (1,2,3))),
@@ -92,7 +94,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString111 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str",
3=>array ())),
@@ -103,7 +105,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString112 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str",
"chain"=>array ("key"=>1,2))),
@@ -116,42 +118,42 @@ class inifileTest extends \PHPUnit_Framework_TestCase
//// TEST OF THE NOT SECTION PART ////
public function testsetString203 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"), FALSE);
$this->assertSame("0 = \"section1\"\n\n", $res);
}
public function testsetString204 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array ()), FALSE);
$this->assertSame("\n", $res);
}
public function testsetString205 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0)), FALSE);
$this->assertSame("section1[0] = \"0\"\n\n", $res);
}
public function testsetString206 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>1)), FALSE);
$this->assertSame("section1[0] = \"1\"\n\n", $res);
}
public function testsetString207 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null)), FALSE);
$this->assertSame("section1[0] = \"null\"\n\n", $res);
}
public function testsetString208 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null, 1=>1)),
FALSE);
$this->assertSame("section1[0] = \"null\"\nsection1[1] = \"1\"\n\n",
@@ -160,7 +162,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString209 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str")),
FALSE);
@@ -172,7 +174,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString210 ()
{
$this->setExpectedException ("Exception");
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str",
3=>array (1,2,3))),
@@ -182,7 +184,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
public function testsetString211 ()
{
$this->setExpectedException ("Exception");
$inifile = new inifile ();
$inifile = new Inifile ();
$res = $inifile->setString (array ("section1"=>array (0=>null,
1=>1, 2=>"str",
3=>array ())),
@@ -193,7 +195,7 @@ class inifileTest extends \PHPUnit_Framework_TestCase
//// LOOP TEST : CREATE AN INI STRING AND PARSE IT ////
public function testLoop406 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$loop = $inifile->setString (array ("section1"=>array (0=>1)), FALSE);
var_dump ($loop);
$res = $inifile->getString ($loop, FALSE);
@@ -203,7 +205,7 @@ var_dump ($res);
public function testLoop407 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$loop = $inifile->setString (array ("section1"=>array (0=>null)), FALSE);
$res = $inifile->getString ($loop, FALSE);
$this->assertSame(array ("section1"=>array (0=>null)), $res);
@@ -211,7 +213,7 @@ var_dump ($res);
public function testLoop408 ()
{
$inifile = new inifile ();
$inifile = new Inifile ();
$loop = $inifile->setString (array ("section1"=>array (0=>"toto")), FALSE);
var_dump ($loop);
$res = $inifile->getString ($loop, FALSE);