mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +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) {
|
function toReadableSize($size) {
|
||||||
switch($size) {
|
switch($size) {
|
||||||
|
case 0:
|
||||||
|
return '0 Bytes';
|
||||||
case 1:
|
case 1:
|
||||||
return '1 Byte';
|
return '1 Byte';
|
||||||
case $size < 1024:
|
case $size < 1024:
|
||||||
|
|
|
@ -69,8 +69,12 @@ class NumberTest extends UnitTestCase {
|
||||||
$result = $this->Helper->currency($value, false);
|
$result = $this->Helper->currency($value, false);
|
||||||
$expected = '100,100,100.00';
|
$expected = '100,100,100.00';
|
||||||
$this->assertEqual($expected, $result);
|
$this->assertEqual($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testToReadableSize() {
|
||||||
|
$result = $this->Helper->toReadableSize(0);
|
||||||
|
$expected = '0 Bytes';
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue