summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/helpers/number_helper_test.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-06-15 00:02:16 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-06-15 00:02:16 +0200
commitc9bb0c5b7a3a349a5c255b02b5cc7ddbe32132e5 (patch)
tree905ff3f3153720c1d1547092e54feaf0e46568a6 /tests/codeigniter/helpers/number_helper_test.php
parent3061ee737ff2c1853428482e1704b0973b621118 (diff)
parentf11a1939c25de1e327c7c02001c8fbd1ec1fc7b4 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'tests/codeigniter/helpers/number_helper_test.php')
-rw-r--r--tests/codeigniter/helpers/number_helper_test.php37
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/codeigniter/helpers/number_helper_test.php b/tests/codeigniter/helpers/number_helper_test.php
index 4bb9a918a..ef6aae138 100644
--- a/tests/codeigniter/helpers/number_helper_test.php
+++ b/tests/codeigniter/helpers/number_helper_test.php
@@ -1,35 +1,35 @@
<?php
class Number_helper_test extends CI_TestCase {
-
+
public function set_up()
{
$this->helper('number');
-
+
// Grab the core lang class
$lang_cls = $this->ci_core_class('lang');
-
+
// Mock away load, too much going on in there,
// we'll just check for the expected parameter
-
+
$lang = $this->getMock($lang_cls, array('load'));
$lang->expects($this->once())
->method('load')
->with($this->equalTo('number'));
-
+
// Assign the proper language array
-
+
$lang->language = $this->_get_lang('number');
-
+
// We don't have a controller, so just create
// a cheap class to act as our super object.
// Make sure it has a lang attribute.
-
- $obj = new StdClass;
+
+ $obj = new stdClass;
$obj->lang = $lang;
$this->ci_instance($obj);
}
-
+
// Quick helper to actually grab the language
// file. Consider moving this to ci_testcase?
public function _get_lang($name)
@@ -37,41 +37,40 @@ class Number_helper_test extends CI_TestCase {
require BASEPATH.'language/english/'.$name.'_lang.php';
return $lang;
}
-
+
public function test_byte_format()
{
$this->assertEquals('456 Bytes', byte_format(456));
}
-
+
public function test_kb_format()
{
$this->assertEquals('4.5 KB', byte_format(4567));
}
-
+
public function test_kb_format_medium()
{
$this->assertEquals('44.6 KB', byte_format(45678));
}
-
+
public function test_kb_format_large()
{
$this->assertEquals('446.1 KB', byte_format(456789));
}
-
+
public function test_mb_format()
{
$this->assertEquals('3.3 MB', byte_format(3456789));
}
-
+
public function test_gb_format()
{
$this->assertEquals('1.8 GB', byte_format(1932735283.2));
}
-
+
public function test_tb_format()
{
$this->assertEquals('112,283.3 TB', byte_format(123456789123456789));
}
-}
-// EOF \ No newline at end of file
+} \ No newline at end of file