这怎么可能? phpunit结果:
--- Expected
+++ Actual
@@ @@
-'€ 10,00'
+'€ 10,00'
代码:
$product = factory(Product::class)->create([
'price' => 1000
]);
$this->assertEquals($product->formattedPrice, '€ 10,00');
我正在使用此类来设置我的货币和语言环境: (省略其他功能)
class Money
{
protected $money;
public function __construct($value)
{
$this->money = new BaseMoney($value, new Currency('EUR'));
}
public function formatted()
{
$formatter = new IntlMoneyFormatter(
new \NumberFormatter('nl_BE', NumberFormatter::CURRENCY),
new ISOCurrencies()
);
return $formatter->format($this->money);
}
}