public function testAccessors() { $money = new Money(1000.0, 'JPY'); $this->assertSame(1000.0, $money->getAmount()); $this->assertEquals('JPY', $money->getCurrency()); $money = new Money(100.5, 'USD'); $this->assertSame(100.5, $money->getAmount()); $this->assertEquals('USD', $money->getCurrency()); }
/** * {@inheritdoc} */ public function jsonSerialize() { return ['id' => $this->id, 'title' => $this->title, 'description' => $this->description, 'language' => $this->language, 'price' => $this->price ? $this->price->getAmount() : null, 'currency' => $this->price ? $this->price->getCurrency() : null, 'count' => $this->count, 'stock' => $this->stock]; }