Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)

This commit is contained in:
2023-04-13 22:22:46 +02:00
parent b017700d0a
commit 273db5f183
51 changed files with 3926 additions and 3637 deletions

View File

@@ -1,16 +1,19 @@
<?php
/** DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
/**
* DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
namespace Domframework\Tests;
use Domframework\Inifile;
/** Test the Inifile.php file */
/**
* Test the Inifile.php file
*/
class InifileTest extends \PHPUnit_Framework_TestCase
{
public function testsetString001()
@@ -23,7 +26,7 @@ class InifileTest extends \PHPUnit_Framework_TestCase
public function testsetString002()
{
$inifile = new Inifile();
$res = $inifile->setString(array (), true);
$res = $inifile->setString([], true);
$this->assertSame("", $res);
}
@@ -32,34 +35,34 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$this->setExpectedException("Exception");
$inifile = new Inifile();
$res = $inifile->setString(array ("section1"), true);
$res = $inifile->setString(["section1"], true);
}
public function testsetString104()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array ()), true);
$res = $inifile->setString(["section1" => []], true);
$this->assertSame("[section1]\n\n", $res);
}
public function testsetString105()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0)), true);
$res = $inifile->setString(["section1" => [0]], true);
$this->assertSame("[section1]\n0 = \"0\"\n\n", $res);
}
public function testsetString106()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0 => 1)), true);
$res = $inifile->setString(["section1" => [0 => 1]], true);
$this->assertSame("[section1]\n0 = \"1\"\n\n", $res);
}
public function testsetString107()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0 => null)), true);
$res = $inifile->setString(["section1" => [0 => null]], true);
$this->assertSame("[section1]\n0 = \"null\"\n\n", $res);
}
@@ -67,7 +70,7 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null, 1 => 1)),
["section1" => [0 => null, 1 => 1]],
true
);
$this->assertSame("[section1]\n0 = \"null\"\n1 = \"1\"\n\n", $res);
@@ -77,8 +80,8 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
1 => 1, 2 => "str")),
["section1" => [0 => null,
1 => 1, 2 => "str"]],
true
);
$this->assertSame(
@@ -91,9 +94,9 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
["section1" => [0 => null,
1 => 1, 2 => "str",
3 => array (1,2,3))),
3 => [1,2,3]]],
true
);
$this->assertSame(
@@ -107,9 +110,9 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
["section1" => [0 => null,
1 => 1, 2 => "str",
3 => array ())),
3 => []]],
true
);
$this->assertSame(
@@ -122,9 +125,9 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
["section1" => [0 => null,
1 => 1, 2 => "str",
"chain" => array ("key" => 1,2))),
"chain" => ["key" => 1,2]]],
true
);
$this->assertSame(
@@ -138,35 +141,35 @@ class InifileTest extends \PHPUnit_Framework_TestCase
public function testsetString203()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1"), false);
$res = $inifile->setString(["section1"], false);
$this->assertSame("0 = \"section1\"\n\n", $res);
}
public function testsetString204()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array ()), false);
$res = $inifile->setString(["section1" => []], false);
$this->assertSame("\n", $res);
}
public function testsetString205()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0)), false);
$res = $inifile->setString(["section1" => [0]], false);
$this->assertSame("section1[0] = \"0\"\n\n", $res);
}
public function testsetString206()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0 => 1)), false);
$res = $inifile->setString(["section1" => [0 => 1]], false);
$this->assertSame("section1[0] = \"1\"\n\n", $res);
}
public function testsetString207()
{
$inifile = new Inifile();
$res = $inifile->setString(array ("section1" => array (0 => null)), false);
$res = $inifile->setString(["section1" => [0 => null]], false);
$this->assertSame("section1[0] = \"null\"\n\n", $res);
}
@@ -174,7 +177,7 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null, 1 => 1)),
["section1" => [0 => null, 1 => 1]],
false
);
$this->assertSame(
@@ -187,8 +190,8 @@ class InifileTest extends \PHPUnit_Framework_TestCase
{
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
1 => 1, 2 => "str")),
["section1" => [0 => null,
1 => 1, 2 => "str"]],
false
);
$this->assertSame(
@@ -203,9 +206,9 @@ class InifileTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException("Exception");
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
["section1" => [0 => null,
1 => 1, 2 => "str",
3 => array (1,2,3))),
3 => [1,2,3]]],
false
);
}
@@ -215,9 +218,9 @@ class InifileTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException("Exception");
$inifile = new Inifile();
$res = $inifile->setString(
array ("section1" => array (0 => null,
["section1" => [0 => null,
1 => 1, 2 => "str",
3 => array ())),
3 => []]],
false
);
}
@@ -227,28 +230,28 @@ class InifileTest extends \PHPUnit_Framework_TestCase
public function testLoop406()
{
$inifile = new Inifile();
$loop = $inifile->setString(array ("section1" => array (0 => 1)), false);
$loop = $inifile->setString(["section1" => [0 => 1]], false);
var_dump($loop);
$res = $inifile->getString($loop, false);
var_dump($res);
$this->assertSame(array ("section1" => array (0 => 1)), $res);
$this->assertSame(["section1" => [0 => 1]], $res);
}
public function testLoop407()
{
$inifile = new Inifile();
$loop = $inifile->setString(array ("section1" => array (0 => null)), false);
$loop = $inifile->setString(["section1" => [0 => null]], false);
$res = $inifile->getString($loop, false);
$this->assertSame(array ("section1" => array (0 => null)), $res);
$this->assertSame(["section1" => [0 => null]], $res);
}
public function testLoop408()
{
$inifile = new Inifile();
$loop = $inifile->setString(array ("section1" => array (0 => "toto")), false);
$loop = $inifile->setString(["section1" => [0 => "toto"]], false);
var_dump($loop);
$res = $inifile->getString($loop, false);
var_dump($res);
$this->assertSame(array ("section1" => array (0 => "toto")), $res);
$this->assertSame(["section1" => [0 => "toto"]], $res);
}
}