/** * NumberHelperTest::testCurrency() * * @return void */ public function testCurrency() { $is = Number::defaultCurrency(); $this->assertEquals('EUR', $is); $is = $this->Number->currency(22.2); $this->assertEquals('22,20 €', $is); }
/** * Transforming int values into ordinal numbers (1st, 3rd, ...). * When using HTML, you can use <sup>, as well. * * @param int $num The number to be suffixed. * @param bool $sup Whether to wrap the suffix in a superscript (<sup>) tag on output. * @return string ordinal */ public function ordinalNumber($num = 0, $sup = false) { $ordinal = Number::ordinal($num); return $sup ? $num . '<sup>' . $ordinal . '</sup>' : $num . $ordinal; }
/** * NumberTest::testCurrencyUnknown() * * @return void */ public function testCurrencyUnknown() { $result = Number::currency('4.111', 'XYZ', ['locale' => 'DE']); $expected = '4,11 XYZ'; file_put_contents(TMP . 'x.txt', $result); $this->assertEquals($expected, $result); }