Commit 998414e5 authored by Thorsten Buss's avatar Thorsten Buss
Browse files

* remove varType currency cause string should possible also

* change test to USD (not DefaultValue)
parent 4a91238b
......@@ -35,7 +35,7 @@ class Money
* @param bool $parseAmountAsMoneyString amount ist unit (not subuit) and in moneyformat (maybe , as dec_mark)
* @throws \Money\InvalidArgumentException
*/
public function __construct($amount, Currency $currency=null, $parseAmountAsMoneyString=false)
public function __construct($amount, $currency=null, $parseAmountAsMoneyString=false)
{
if (!is_int($amount) && !ctype_digit($amount)) { // only numbers(int) - as string or int type
throw new InvalidArgumentException("The first parameter of Money must be an integer. It's the amount, expressed in the smallest units of currency (eg cents)");
......
......@@ -15,14 +15,14 @@ use Money\MoneyFormater;
class MoneyFormaterTest extends MoneyTestCase {
public function testFormater() {
$m = new MoneyFormater('EUR');
$this->assertEquals('€1.234,56', $m->format(123456));
$this->assertEquals('€1.234', $m->format(123456, array('no_cents' => true)));
$m = new MoneyFormater('USD');
$this->assertEquals('$1,234.56', $m->format(123456));
$this->assertEquals('$1,234', $m->format(123456, array('no_cents' => true)));
// with defaultParams
$m = new MoneyFormater('EUR', array('symbol' => '~'));
$this->assertEquals('~1.234,56', $m->format(123456));
$this->assertEquals('~1.234', $m->format(123456, array('no_cents' => true)));
$m = new MoneyFormater('USD', array('symbol' => '~'));
$this->assertEquals('~1,234.56', $m->format(123456));
$this->assertEquals('~1,234', $m->format(123456, array('no_cents' => true)));
}
public function testLegibly() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment