2008-05-30 11:40:08 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2012-02-06 10:01:55 +00:00
|
|
|
* CakeNumberTest file
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* PHP 5
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2012-04-27 02:49:18 +00:00
|
|
|
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
2013-02-08 11:59:49 +00:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* Licensed under The MIT License
|
2013-02-08 12:22:51 +00:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2010-10-03 16:31:21 +00:00
|
|
|
* Redistributions of files must retain the above copyright notice
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2013-02-08 11:59:49 +00:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2012-04-27 02:49:18 +00:00
|
|
|
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Test.Case.View.Helper
|
2008-10-30 17:30:26 +00:00
|
|
|
* @since CakePHP(tm) v 1.2.0.4206
|
2010-10-03 16:27:27 +00:00
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
2010-12-15 05:43:05 +00:00
|
|
|
|
|
|
|
App::uses('View', 'View');
|
2012-02-06 10:01:55 +00:00
|
|
|
App::uses('CakeNumber', 'Utility');
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
/**
|
2012-02-06 10:01:55 +00:00
|
|
|
* CakeNumberTest class
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2012-02-06 10:01:55 +00:00
|
|
|
* @package Cake.Test.Case.Utility
|
2008-06-02 19:22:55 +00:00
|
|
|
*/
|
2012-02-06 10:01:55 +00:00
|
|
|
class CakeNumberTest extends CakeTestCase {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* setUp method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function setUp() {
|
2010-09-26 01:36:49 +00:00
|
|
|
parent::setUp();
|
2012-02-06 10:01:55 +00:00
|
|
|
$this->Number = new CakeNumber();
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-19 21:10:13 +00:00
|
|
|
/**
|
|
|
|
* tearDown method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function tearDown() {
|
2010-09-26 01:36:49 +00:00
|
|
|
parent::tearDown();
|
2009-03-19 21:10:13 +00:00
|
|
|
unset($this->Number);
|
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testFormatAndCurrency method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testFormat() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '100100100';
|
|
|
|
|
|
|
|
$result = $this->Number->format($value, '#');
|
|
|
|
$expected = '#100,100,100';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->format($value, 3);
|
|
|
|
$expected = '100,100,100.000';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->format($value);
|
|
|
|
$expected = '100,100,100';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->format($value, '-');
|
|
|
|
$expected = '100-100-100';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2012-09-19 23:41:41 +00:00
|
|
|
|
|
|
|
$value = 0.00001;
|
|
|
|
$result = $this->Number->format($value, array('places' => 1));
|
|
|
|
$expected = '$0.0';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$value = -0.00001;
|
|
|
|
$result = $this->Number->format($value, array('places' => 1));
|
|
|
|
$expected = '$0.0';
|
|
|
|
$this->assertEquals($expected, $result);
|
2013-03-06 22:35:18 +00:00
|
|
|
|
|
|
|
$value = 1.23;
|
|
|
|
$options = array('decimals' => ',', 'thousands' => '.', 'before' => '', 'after' => ' €');
|
|
|
|
$result = $this->Number->format($value, $options);
|
|
|
|
$expected = '1,23 €';
|
|
|
|
$this->assertEquals($expected, $result);
|
2012-09-19 23:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testFormatDelta method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testFormatDelta() {
|
|
|
|
$value = '100100100';
|
|
|
|
|
2012-09-19 23:56:52 +00:00
|
|
|
$result = $this->Number->formatDelta($value);
|
|
|
|
$expected = '+100,100,100.00';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
2012-09-19 23:41:41 +00:00
|
|
|
$result = $this->Number->formatDelta($value, array('before' => '', 'after' => ''));
|
|
|
|
$expected = '+100,100,100.00';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->formatDelta($value, array('before' => '[', 'after' => ']'));
|
|
|
|
$expected = '[+100,100,100.00]';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->formatDelta(-$value, array('before' => '[', 'after' => ']'));
|
|
|
|
$expected = '[-100,100,100.00]';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$result = $this->Number->formatDelta(-$value, array('before' => '[ ', 'after' => ' ]'));
|
|
|
|
$expected = '[ -100,100,100.00 ]';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
2012-09-19 23:41:41 +00:00
|
|
|
$value = 0;
|
|
|
|
$result = $this->Number->formatDelta($value, array('places' => 1, 'before' => '[', 'after' => ']'));
|
|
|
|
$expected = '[0.0]';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$value = 0.0001;
|
|
|
|
$result = $this->Number->formatDelta($value, array('places' => 1, 'before' => '[', 'after' => ']'));
|
|
|
|
$expected = '[0.0]';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$value = 9876.1234;
|
|
|
|
$result = $this->Number->formatDelta($value, array('places' => 1, 'decimals' => ',', 'thousands' => '.'));
|
|
|
|
$expected = '+9.876,1';
|
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:29:10 +00:00
|
|
|
}
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2012-03-28 06:43:55 +00:00
|
|
|
/**
|
|
|
|
* testMultibyteFormat
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testMultibyteFormat() {
|
|
|
|
$value = '5199100.0006';
|
|
|
|
$result = $this->Number->format($value, array(
|
|
|
|
'thousands' => ' ',
|
|
|
|
'decimals' => '&',
|
|
|
|
'places' => 3,
|
|
|
|
'escape' => false,
|
|
|
|
'before' => '',
|
|
|
|
));
|
|
|
|
$expected = '5 199 100&001';
|
2012-04-21 13:02:35 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2012-03-28 06:43:55 +00:00
|
|
|
|
|
|
|
$value = 1000.45;
|
|
|
|
$result = $this->Number->format($value, array(
|
|
|
|
'thousands' => ',,',
|
|
|
|
'decimals' => '.a',
|
|
|
|
'escape' => false,
|
|
|
|
));
|
|
|
|
$expected = '$1,,000.a45';
|
2012-04-21 13:02:35 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2012-03-28 06:43:55 +00:00
|
|
|
|
|
|
|
$value = 519919827593784.00;
|
|
|
|
$this->Number->addFormat('RUR', array(
|
|
|
|
'thousands' => 'ø€ƒ‡™',
|
|
|
|
'decimals' => '(§.§)',
|
|
|
|
'escape' => false,
|
|
|
|
'wholeSymbol' => '€',
|
|
|
|
'wholePosition' => 'after',
|
|
|
|
));
|
|
|
|
$result = $this->Number->currency($value, 'RUR');
|
|
|
|
$expected = '519ø€ƒ‡™919ø€ƒ‡™827ø€ƒ‡™593ø€ƒ‡™784(§.§)00€';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$value = '13371337.1337';
|
|
|
|
$result = CakeNumber::format($value, array(
|
|
|
|
'thousands' => '- |-| /-\ >< () |2 -',
|
|
|
|
'decimals' => '- £€€† -',
|
|
|
|
'before' => ''
|
|
|
|
));
|
|
|
|
$expected = '13- |-| /-\ >< () |2 -371- |-| /-\ >< () |2 -337- £€€† -13';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
}
|
|
|
|
|
2009-09-11 02:29:10 +00:00
|
|
|
/**
|
|
|
|
* Test currency method.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrency() {
|
2009-09-11 02:54:49 +00:00
|
|
|
$value = '100100100';
|
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
$result = $this->Number->currency($value);
|
|
|
|
$expected = '$100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, '#');
|
|
|
|
$expected = '#100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, false);
|
|
|
|
$expected = '100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'USD');
|
|
|
|
$expected = '$100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€100.100.100,00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-03-03 15:32:12 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('thousands' => ' ', 'wholeSymbol' => 'EUR ', 'wholePosition' => 'before',
|
|
|
|
'decimals' => ',', 'zero' => 'Gratuit');
|
|
|
|
$result = $this->Number->currency($value, '', $options);
|
|
|
|
$expected = 'EUR 100 100 100,00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-03-19 21:10:13 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('after' => 'øre', 'before' => 'Kr.', 'decimals' => ',', 'thousands' => '.');
|
|
|
|
$result = $this->Number->currency(1000.45, null, $options);
|
|
|
|
$expected = 'Kr.1.000,45';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:29:10 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(0.5, 'USD');
|
|
|
|
$expected = '50c';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:29:10 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->currency(0.5, null, array('after' => 'øre'));
|
2009-09-11 02:29:10 +00:00
|
|
|
$expected = '50øre';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(1, null, array('wholeSymbol' => '$ '));
|
|
|
|
$expected = '$ 1.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(1, null, array('wholeSymbol' => ' $', 'wholePosition' => 'after'));
|
|
|
|
$expected = '1.00 $';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('wholeSymbol' => '$', 'wholePosition' => 'after', 'fractionSymbol' => ' cents');
|
|
|
|
$result = $this->Number->currency(0.2, null, $options);
|
|
|
|
$expected = '20 cents';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('wholeSymbol' => '$', 'wholePosition' => 'after', 'fractionSymbol' => 'cents ',
|
|
|
|
'fractionPosition' => 'before');
|
|
|
|
$result = $this->Number->currency(0.2, null, $options);
|
|
|
|
$expected = 'cents 20';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(311, 'USD', array('wholePosition' => 'after'));
|
|
|
|
$expected = '311.00$';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2012-01-19 21:24:00 +00:00
|
|
|
$result = $this->Number->currency(0.2, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€0,20';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('wholeSymbol' => ' dollars', 'wholePosition' => 'after', 'fractionSymbol' => ' cents',
|
|
|
|
'fractionPosition' => 'after');
|
|
|
|
$result = $this->Number->currency(12, null, $options);
|
2011-03-02 01:14:15 +00:00
|
|
|
$expected = '12.00 dollars';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('wholeSymbol' => ' dollars', 'wholePosition' => 'after', 'fractionSymbol' => ' cents',
|
|
|
|
'fractionPosition' => 'after');
|
|
|
|
$result = $this->Number->currency(0.12, null, $options);
|
2011-03-02 01:14:15 +00:00
|
|
|
$expected = '12 cents';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-03-02 01:14:15 +00:00
|
|
|
|
2013-03-06 22:35:18 +00:00
|
|
|
$options = array('fractionSymbol' => false, 'fractionPosition' => 'before', 'wholeSymbol' => '$');
|
|
|
|
$result = $this->Number->currency(0.5, null, $options);
|
2011-03-02 01:14:15 +00:00
|
|
|
$expected = '$0.50';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2013-01-11 17:00:06 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(0, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£0.00';
|
2013-01-11 17:00:06 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency(0.00000, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£0.00';
|
2013-01-11 17:00:06 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency('0.00000', 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£0.00';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency('-2.23300', 'JPY');
|
|
|
|
$expected = '(¥2.23)';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency('22.389', 'CAD');
|
|
|
|
$expected = '$22.39';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency('4.111', 'AUD');
|
|
|
|
$expected = '$4.11';
|
2013-01-11 17:00:06 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:29:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test adding currency format options to the number helper
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyAddFormat() {
|
2009-09-11 02:54:49 +00:00
|
|
|
$this->Number->addFormat('NOK', array('before' => 'Kr. '));
|
|
|
|
$result = $this->Number->currency(1000, 'NOK');
|
2009-09-11 02:29:10 +00:00
|
|
|
$expected = 'Kr. 1,000.00';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:54:49 +00:00
|
|
|
|
|
|
|
$this->Number->addFormat('Other', array('before' => '$$ ', 'after' => 'c!'));
|
|
|
|
$result = $this->Number->currency(0.22, 'Other');
|
|
|
|
$expected = '22c!';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-09-11 02:54:49 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency(-10, 'Other');
|
|
|
|
$expected = '($$ 10.00)';
|
2011-12-16 06:52:07 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2012-01-19 21:24:00 +00:00
|
|
|
|
|
|
|
$this->Number->addFormat('Other2', array('before' => '$ ', 'after' => false));
|
|
|
|
$result = $this->Number->currency(0.22, 'Other2');
|
|
|
|
$expected = '$ 0.22';
|
2012-05-19 14:48:15 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2012-10-26 17:32:39 +00:00
|
|
|
/**
|
|
|
|
* Test default currency
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testDefaultCurrency() {
|
|
|
|
$result = $this->Number->defaultCurrency();
|
|
|
|
$this->assertEquals('USD', $result);
|
|
|
|
$this->Number->addFormat('NOK', array('before' => 'Kr. '));
|
|
|
|
|
|
|
|
$this->Number->defaultCurrency('NOK');
|
|
|
|
$result = $this->Number->defaultCurrency();
|
|
|
|
$this->assertEquals('NOK', $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency(1000);
|
|
|
|
$expected = 'Kr. 1,000.00';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency(2000);
|
|
|
|
$expected = 'Kr. 2,000.00';
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
$this->Number->defaultCurrency('EUR');
|
|
|
|
$result = $this->Number->currency(1000);
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€1.000,00';
|
2012-10-26 17:32:39 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$result = $this->Number->currency(2000);
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€2.000,00';
|
2012-10-26 17:32:39 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
$this->Number->defaultCurrency('USD');
|
|
|
|
}
|
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyPositive method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyPositive() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '100100100';
|
|
|
|
|
|
|
|
$result = $this->Number->currency($value);
|
|
|
|
$expected = '$100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'USD', array('before' => '#'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = '#100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, false);
|
|
|
|
$expected = '100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'USD');
|
|
|
|
$expected = '$100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€100.100.100,00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyNegative method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyNegative() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '-100100100';
|
|
|
|
|
|
|
|
$result = $this->Number->currency($value);
|
|
|
|
$expected = '($100,100,100.00)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '(€100.100.100,00)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '(£100,100,100.00)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'USD', array('negative' => '-'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = '-$100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'EUR', array('negative' => '-'));
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '-€100.100.100,00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'GBP', array('negative' => '-'));
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '-£100,100,100.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyCentsPositive method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyCentsPositive() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '0.99';
|
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'USD');
|
|
|
|
$expected = '99c';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€0,99';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
|
|
|
$expected = '99p';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyCentsNegative method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyCentsNegative() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '-0.99';
|
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'USD');
|
|
|
|
$expected = '(99c)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '(€0,99)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
|
|
|
$expected = '(99p)';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'USD', array('negative' => '-'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = '-99c';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'EUR', array('negative' => '-'));
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '-€0,99';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2011-12-01 07:21:31 +00:00
|
|
|
$result = $this->Number->currency($value, 'GBP', array('negative' => '-'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = '-99p';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyZero method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyZero() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '0';
|
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'USD');
|
|
|
|
$expected = '$0.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€0,00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency($value, 'GBP');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£0.00';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2009-09-11 02:29:10 +00:00
|
|
|
$result = $this->Number->currency($value, 'GBP', array('zero' => 'FREE!'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = 'FREE!';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testCurrencyOptions method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCurrencyOptions() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$value = '1234567.89';
|
|
|
|
|
2009-09-11 02:29:10 +00:00
|
|
|
$result = $this->Number->currency($value, null, array('before' => 'GBP'));
|
2008-05-30 11:40:08 +00:00
|
|
|
$expected = 'GBP1,234,567.89';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2009-09-11 02:29:10 +00:00
|
|
|
$result = $this->Number->currency($value, 'GBP', array('places' => 0));
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '£1,234,568';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2010-12-01 17:07:45 +00:00
|
|
|
$result = $this->Number->currency('1234567.8912345', null, array('before' => 'GBP', 'places' => 3));
|
|
|
|
$expected = 'GBP1,234,567.891';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2010-12-01 17:07:45 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency('650.120001', null, array('before' => 'GBP', 'places' => 4));
|
|
|
|
$expected = 'GBP650.1200';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2010-12-01 17:07:45 +00:00
|
|
|
|
2013-03-10 17:26:58 +00:00
|
|
|
$result = $this->Number->currency($value, 'GBP', array('before' => '£ ', 'escape' => true));
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '&#163; 1,234,567.89';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-12-23 00:11:52 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency('0.35', 'USD', array('after' => false));
|
|
|
|
$expected = '$0.35';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-12-23 00:11:52 +00:00
|
|
|
|
2013-03-10 17:11:50 +00:00
|
|
|
$result = $this->Number->currency('0.35', 'GBP', array('before' => '£', 'after' => false, 'escape' => false));
|
2009-12-23 00:11:52 +00:00
|
|
|
$expected = '£0.35';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2009-12-23 00:11:52 +00:00
|
|
|
|
|
|
|
$result = $this->Number->currency('0.35', 'GBP');
|
|
|
|
$expected = '35p';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2011-05-16 22:49:00 +00:00
|
|
|
|
2010-11-03 01:56:24 +00:00
|
|
|
$result = $this->Number->currency('0.35', 'EUR');
|
2013-03-06 22:35:18 +00:00
|
|
|
$expected = '€0,35';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testToReadableSize method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testToReadableSize() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$result = $this->Number->toReadableSize(0);
|
|
|
|
$expected = '0 Bytes';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toReadableSize(1);
|
|
|
|
$expected = '1 Byte';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2008-10-29 01:15:59 +00:00
|
|
|
$result = $this->Number->toReadableSize(45);
|
|
|
|
$expected = '45 Bytes';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toReadableSize(1023);
|
|
|
|
$expected = '1023 Bytes';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toReadableSize(1024);
|
|
|
|
$expected = '1 KB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 512);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '512 KB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 - 1);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '1.00 MB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 512);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '512.00 MB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 - 1);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '1.00 GB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '512.00 GB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 - 1);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '1.00 TB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 512);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '512.00 TB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 1024 - 1);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = '1024.00 TB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-10-29 01:15:59 +00:00
|
|
|
|
2012-03-14 02:59:20 +00:00
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 1024 * 1024);
|
2008-10-29 01:15:59 +00:00
|
|
|
$expected = (1024 * 1024) . '.00 TB';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2012-06-19 03:13:05 +00:00
|
|
|
/**
|
|
|
|
* test toReadableSize() with locales
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testReadableSizeLocalized() {
|
2012-06-19 21:20:08 +00:00
|
|
|
$restore = setlocale(LC_NUMERIC, 0);
|
|
|
|
setlocale(LC_NUMERIC, 'de_DE');
|
2012-06-19 03:13:05 +00:00
|
|
|
$result = $this->Number->toReadableSize(1321205);
|
2012-06-19 03:45:44 +00:00
|
|
|
$this->assertRegExp('/1[,.]26 MB/', $result);
|
2012-06-19 03:13:05 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
|
2012-06-19 03:45:44 +00:00
|
|
|
$this->assertRegExp('/512[,.]00 GB/', $result);
|
2012-06-19 21:20:08 +00:00
|
|
|
setlocale(LC_NUMERIC, $restore);
|
2012-06-19 03:13:05 +00:00
|
|
|
}
|
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* testToPercentage method
|
2008-10-29 01:15:59 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testToPercentage() {
|
2008-05-30 11:40:08 +00:00
|
|
|
$result = $this->Number->toPercentage(45, 0);
|
|
|
|
$expected = '45%';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toPercentage(45, 2);
|
|
|
|
$expected = '45.00%';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toPercentage(0, 0);
|
|
|
|
$expected = '0%';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
|
|
|
|
$result = $this->Number->toPercentage(0, 4);
|
|
|
|
$expected = '0.0000%';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2012-03-14 02:59:20 +00:00
|
|
|
|
2012-06-25 15:34:30 +00:00
|
|
|
/**
|
|
|
|
* testFromReadableSize
|
|
|
|
*
|
|
|
|
* @dataProvider filesizes
|
|
|
|
* @return void
|
|
|
|
*/
|
2012-09-17 09:29:13 +00:00
|
|
|
public function testFromReadableSize($params, $expected) {
|
|
|
|
$result = $this->Number->fromReadableSize($params['size'], $params['default']);
|
2012-06-25 15:34:30 +00:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testFromReadableSize
|
|
|
|
*
|
|
|
|
* @expectedException CakeException
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testFromReadableSizeException() {
|
2013-01-23 12:45:50 +00:00
|
|
|
$this->Number->fromReadableSize('bogus', false);
|
2012-06-25 15:34:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* filesizes dataprovider
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function filesizes() {
|
|
|
|
return array(
|
2012-09-17 09:29:13 +00:00
|
|
|
array(array('size' => '512B', 'default' => false), 512),
|
|
|
|
array(array('size' => '1KB', 'default' => false), 1024),
|
|
|
|
array(array('size' => '1.5KB', 'default' => false), 1536),
|
|
|
|
array(array('size' => '1MB', 'default' => false), 1048576),
|
2012-09-18 15:15:33 +00:00
|
|
|
array(array('size' => '1mb', 'default' => false), 1048576),
|
2012-09-17 09:29:13 +00:00
|
|
|
array(array('size' => '1.5MB', 'default' => false), 1572864),
|
|
|
|
array(array('size' => '1GB', 'default' => false), 1073741824),
|
|
|
|
array(array('size' => '1.5GB', 'default' => false), 1610612736),
|
2012-12-21 19:39:02 +00:00
|
|
|
array(array('size' => '1K', 'default' => false), 1024),
|
|
|
|
array(array('size' => '1.5K', 'default' => false), 1536),
|
|
|
|
array(array('size' => '1M', 'default' => false), 1048576),
|
|
|
|
array(array('size' => '1m', 'default' => false), 1048576),
|
|
|
|
array(array('size' => '1.5M', 'default' => false), 1572864),
|
|
|
|
array(array('size' => '1G', 'default' => false), 1073741824),
|
|
|
|
array(array('size' => '1.5G', 'default' => false), 1610612736),
|
2012-09-17 09:29:13 +00:00
|
|
|
array(array('size' => '512', 'default' => 'Unknown type'), 512),
|
|
|
|
array(array('size' => '2VB', 'default' => 'Unknown type'), 'Unknown type')
|
2012-06-25 15:34:30 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|