Number and File class tests

This commit is contained in:
Joshua Sherman 2014-01-02 00:56:20 -05:00
parent e9456600a7
commit 5308f4ea6c
3 changed files with 74 additions and 3 deletions

View file

@ -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

View 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));
}
}
?>

View 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>'),
);
}
}
?>