git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3769 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
require_once ("convert.php");
|
|
|
|
/** Test the Conversion of format */
|
|
class test_convert extends PHPUnit_Framework_TestCase
|
|
{
|
|
public function test_convertDate1 ()
|
|
{
|
|
$res = \convert::convertDate ("2017-04-13", "Y-m-d", "d/m/Y");
|
|
$this->assertSame ($res, "13/04/2017");
|
|
}
|
|
|
|
public function test_convertDate2 ()
|
|
{
|
|
$this->setExpectedException ("Exception");
|
|
$res = \convert::convertDate ("2017-13-33", "Y-m-d", "d/m/Y");
|
|
}
|
|
|
|
public function test_convertDate3 ()
|
|
{
|
|
$res = \convert::convertDate ("2017-13-33", "Y-m-d", "d/m/Y", false);
|
|
$this->assertSame ($res, "2017-13-33");
|
|
}
|
|
|
|
public function test_ucwords_1 ()
|
|
{
|
|
$res = \convert::ucwords (" test yuyu ");
|
|
$this->assertSame ($res, " Test Yuyu ");
|
|
}
|
|
|
|
public function test_ucwords_2 ()
|
|
{
|
|
$res = \convert::ucwords ("");
|
|
$this->assertSame ($res, "");
|
|
}
|
|
|
|
public function test_ucwords_3 ()
|
|
{
|
|
$res = \convert::ucwords ("test");
|
|
$this->assertSame ($res, "Test");
|
|
}
|
|
|
|
public function test_ucwords_4 ()
|
|
{
|
|
$res = \convert::ucwords ("TEST");
|
|
$this->assertSame ($res, "Test");
|
|
}
|
|
|
|
public function test_ucwords_5 ()
|
|
{
|
|
$res = \convert::ucwords ("édouard étienne");
|
|
$this->assertSame ($res, "Édouard Étienne");
|
|
}
|
|
|
|
public function test_ucwords_6 ()
|
|
{
|
|
$res = \convert::ucwords ("édou-ard d'étienne", " -'");
|
|
$this->assertSame ($res, "Édou-Ard D'Étienne");
|
|
}
|
|
}
|