Fixing problem with handling "0" in NumberHelper::toReadableSize() (ticket #2654)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5195 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-05-26 07:22:19 +00:00
parent 24dd6ddb0a
commit a357f30cda
2 changed files with 8 additions and 2 deletions

View file

@ -58,6 +58,8 @@ class NumberHelper extends AppHelper {
*/
function toReadableSize($size) {
switch($size) {
case 0:
return '0 Bytes';
case 1:
return '1 Byte';
case $size < 1024:

View file

@ -69,10 +69,14 @@ class NumberTest extends UnitTestCase {
$result = $this->Helper->currency($value, false);
$expected = '100,100,100.00';
$this->assertEqual($expected, $result);
}
function testToReadableSize() {
$result = $this->Helper->toReadableSize(0);
$expected = '0 Bytes';
$this->assertEqual($expected, $result);
}
function tearDown() {
unset($this->Helper);
}