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,67 +1,70 @@
<?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\Convert;
/** Test the Conversion of format */
/**
* Test the Conversion of format
*/
class ConvertTest extends \PHPUnit_Framework_TestCase
{
public function test_convertDate1()
public function testConvertDate1()
{
$res = Convert::convertDate("2017-04-13", "Y-m-d", "d/m/Y");
$this->assertSame($res, "13/04/2017");
}
public function test_convertDate2()
public function testConvertDate2()
{
$this->setExpectedException("Exception");
$res = Convert::convertDate("2017-13-33", "Y-m-d", "d/m/Y");
}
public function test_convertDate3()
public function testConvertDate3()
{
$res = Convert::convertDate("2017-13-33", "Y-m-d", "d/m/Y", false);
$this->assertSame($res, "2017-13-33");
}
public function test_ucwords_1()
public function testUcwords1()
{
$res = Convert::ucwords(" test yuyu ");
$this->assertSame($res, " Test Yuyu ");
}
public function test_ucwords_2()
public function testUcwords2()
{
$res = Convert::ucwords("");
$this->assertSame($res, "");
}
public function test_ucwords_3()
public function testUcwords3()
{
$res = Convert::ucwords("test");
$this->assertSame($res, "Test");
}
public function test_ucwords_4()
public function testUcwords4()
{
$res = Convert::ucwords("TEST");
$this->assertSame($res, "Test");
}
public function test_ucwords_5()
public function testUcwords5()
{
$res = Convert::ucwords("édouard étienne");
$this->assertSame($res, "Édouard Étienne");
}
public function test_ucwords_6()
public function testUcwords6()
{
$res = Convert::ucwords("édou-ard d'étienne", " -'");
$this->assertSame($res, "Édou-Ard D'Étienne");
@@ -70,7 +73,7 @@ class ConvertTest extends \PHPUnit_Framework_TestCase
/////////////////////
// humanSize //
/////////////////////
public function test_humanSize_1()
public function testHumanSize1()
{
$res = "";
for ($i = -8; $i <= 8; $i++) {
@@ -81,47 +84,47 @@ class ConvertTest extends \PHPUnit_Framework_TestCase
"1.44ZB\n1.44YB\n");
}
public function test_humanSize_2()
public function testHumanSize2()
{
$res = Convert::humanSize(1441234);
$this->assertSame($res, "1.44MB");
}
public function test_humanSize_3()
public function testHumanSize3()
{
$res = Convert::humanSize(10441234);
$this->assertSame($res, "10.44MB");
}
public function test_humanSize_4()
public function testHumanSize4()
{
$res = Convert::humanSize(0.123, 0);
$this->assertSame($res, "123mB");
}
public function test_humanSize_5()
public function testHumanSize5()
{
$res = Convert::humanSize(0.12345, 2);
$this->assertSame($res, "123.45mB");
}
public function test_humanSize_6()
public function testHumanSize6()
{
$res = Convert::humanSize(-0.12345, 2);
$this->assertSame($res, "-123.45mB");
}
public function test_humanSize_7()
public function testHumanSize7()
{
$res = Convert::humanSize(-12345, 2);
$this->assertSame($res, "-12.35kB");
}
public function test_humanSize_8()
public function testHumanSize8()
{
$res = Convert::humanSize(0, 2);
$this->assertSame($res, "0.00B");
}
public function test_humanSize_error1()
public function testHumanSizeError1()
{
$this->expectException(
"Exception",
@@ -131,7 +134,7 @@ class ConvertTest extends \PHPUnit_Framework_TestCase
$res = Convert::humanSize("1441234");
}
public function test_humanSize_error2()
public function testHumanSizeError2()
{
$this->expectException(
"Exception",
@@ -141,7 +144,7 @@ class ConvertTest extends \PHPUnit_Framework_TestCase
$res = Convert::humanSize(1441234, 0.1);
}
public function test_humanSize_error3()
public function testHumanSizeError3()
{
$this->expectException(
"Exception",
@@ -151,7 +154,7 @@ class ConvertTest extends \PHPUnit_Framework_TestCase
$res = Convert::humanSize(1441234, -1);
}
public function test_humanSize_error4()
public function testHumanSizeError4()
{
$this->expectException(
"Exception",