mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
24dd6ddb0a
commit
a357f30cda
2 changed files with 8 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue