Number and File class tests
This commit is contained in:
parent
e9456600a7
commit
5308f4ea6c
3 changed files with 74 additions and 3 deletions
|
@ -2,17 +2,18 @@ Cache
|
|||
Config
|
||||
Database
|
||||
Dynamic
|
||||
File
|
||||
Form
|
||||
HTML
|
||||
Log
|
||||
Model
|
||||
Module
|
||||
Number
|
||||
Object
|
||||
Profiler
|
||||
Security
|
||||
Session
|
||||
Validate
|
||||
|
||||
Stuff in API directory
|
||||
API/AYAH
|
||||
API/Gravatar
|
||||
API/Tinychat
|
||||
API/Google/Profanity
|
||||
|
|
20
tests/classes/FileTest.php
Normal file
20
tests/classes/FileTest.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
class FileTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testRemoveDirectory()
|
||||
{
|
||||
$directory = SITE_PATH . 'test/test/test/';
|
||||
|
||||
mkdir($directory, 0777, true);
|
||||
touch(SITE_PATH . 'test/ing');
|
||||
touch(SITE_PATH . 'test/test/ing');
|
||||
touch(SITE_PATH . 'test/test/test/ing');
|
||||
|
||||
File::removeDirectory($directory);
|
||||
|
||||
$this->assertFalse(file_exists($directory));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
50
tests/classes/NumberTest.php
Normal file
50
tests/classes/NumberTest.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
class NumberTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider providerOrginalIndicatorNoSuper
|
||||
*/
|
||||
public function testOrdinalIndicatorNoSuper($a, $b)
|
||||
{
|
||||
$this->assertEquals($b, Number::ordinalIndicator($a));
|
||||
}
|
||||
|
||||
public function providerOrginalIndicatorNoSuper()
|
||||
{
|
||||
return array(
|
||||
array(1, '1st'),
|
||||
array(2, '2nd'),
|
||||
array(3, '3rd'),
|
||||
array(4, '4th'),
|
||||
array(51, '51st'),
|
||||
array(52, '52nd'),
|
||||
array(53, '53rd'),
|
||||
array(54, '54th'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerOrginalIndicatorSuper
|
||||
*/
|
||||
public function testOrdinalIndicatorSuper($a, $b)
|
||||
{
|
||||
$this->assertEquals($b, Number::ordinalIndicator($a, true));
|
||||
}
|
||||
|
||||
public function providerOrginalIndicatorSuper()
|
||||
{
|
||||
return array(
|
||||
array(1, '1<sup>st</sup>'),
|
||||
array(2, '2<sup>nd</sup>'),
|
||||
array(3, '3<sup>rd</sup>'),
|
||||
array(4, '4<sup>th</sup>'),
|
||||
array(51, '51<sup>st</sup>'),
|
||||
array(52, '52<sup>nd</sup>'),
|
||||
array(53, '53<sup>rd</sup>'),
|
||||
array(54, '54<sup>th</sup>'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue