|
@@ -66,47 +66,47 @@ class NumberHelperTest extends TestCase {
|
|
|
public function testFormat() {
|
|
public function testFormat() {
|
|
|
$is = $this->Number->format('22');
|
|
$is = $this->Number->format('22');
|
|
|
$expected = '22';
|
|
$expected = '22';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.01');
|
|
$is = $this->Number->format('22.01');
|
|
|
$expected = '22,01';
|
|
$expected = '22,01';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22', ['places' => 2]);
|
|
$is = $this->Number->format('22', ['places' => 2]);
|
|
|
$expected = '22,00';
|
|
$expected = '22,00';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.30', ['places' => 1]);
|
|
$is = $this->Number->format('22.30', ['places' => 1]);
|
|
|
$expected = '22,3';
|
|
$expected = '22,3';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.30', ['precision' => -1]);
|
|
$is = $this->Number->format('22.30', ['precision' => -1]);
|
|
|
- $expected = '22,3'; // Why?
|
|
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $expected = '22'; // Why 22,3 locally?
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.30', ['places' => 3]);
|
|
$is = $this->Number->format('22.30', ['places' => 3]);
|
|
|
$expected = '22,300';
|
|
$expected = '22,300';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('abc', ['places' => 2]);
|
|
$is = $this->Number->format('abc', ['places' => 2]);
|
|
|
$expected = '0,00';
|
|
$expected = '0,00';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'before' => 'EUR ']);
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'before' => 'EUR ']);
|
|
|
$expected = 'EUR 22,30';
|
|
$expected = 'EUR 22,30';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'after' => ' EUR']);
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'after' => ' EUR']);
|
|
|
$expected = '22,30 EUR';
|
|
$expected = '22,30 EUR';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'after' => 'x', 'before' => 'v']);
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'after' => 'x', 'before' => 'v']);
|
|
|
$expected = 'v22,30x';
|
|
$expected = 'v22,30x';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
|
|
|
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'locale' => 'en-US']);
|
|
$is = $this->Number->format('22.3', ['places' => 2, 'locale' => 'en-US']);
|
|
|
$expected = '22.30';
|
|
$expected = '22.30';
|
|
|
- $this->assertEquals($expected, $is);
|
|
|
|
|
|
|
+ $this->assertSame($expected, $is);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,10 +116,10 @@ class NumberHelperTest extends TestCase {
|
|
|
*/
|
|
*/
|
|
|
public function testCurrency() {
|
|
public function testCurrency() {
|
|
|
$is = Number::defaultCurrency();
|
|
$is = Number::defaultCurrency();
|
|
|
- $this->assertEquals('EUR', $is);
|
|
|
|
|
|
|
+ $this->assertSame('EUR', $is);
|
|
|
|
|
|
|
|
$is = $this->Number->currency(22.2);
|
|
$is = $this->Number->currency(22.2);
|
|
|
- $this->assertEquals('22,20 €', $is);
|
|
|
|
|
|
|
+ $this->assertSame('22,20 €', $is);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -129,13 +129,13 @@ class NumberHelperTest extends TestCase {
|
|
|
*/
|
|
*/
|
|
|
public function testToReadableSize() {
|
|
public function testToReadableSize() {
|
|
|
$is = $this->Number->toReadableSize(1206);
|
|
$is = $this->Number->toReadableSize(1206);
|
|
|
- $this->assertEquals('1,18 KB', $is);
|
|
|
|
|
|
|
+ $this->assertSame('1,18 KB', $is);
|
|
|
|
|
|
|
|
$is = $this->Number->toReadableSize(1024 * 1024 * 1024);
|
|
$is = $this->Number->toReadableSize(1024 * 1024 * 1024);
|
|
|
- $this->assertEquals('1 GB', $is);
|
|
|
|
|
|
|
+ $this->assertSame('1 GB', $is);
|
|
|
|
|
|
|
|
$is = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 2.5);
|
|
$is = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 2.5);
|
|
|
- $this->assertEquals('2,5 TB', $is);
|
|
|
|
|
|
|
+ $this->assertSame('2,5 TB', $is);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|