diff --git a/src/Hydrator/MoneyHydrator.php b/src/Hydrator/MoneyHydrator.php index 8c47317..9a6c488 100644 --- a/src/Hydrator/MoneyHydrator.php +++ b/src/Hydrator/MoneyHydrator.php @@ -20,7 +20,7 @@ class MoneyHydrator implements HydratorInterface public function extract($object) { return [ - 'amount' => $object->getAmount(), + 'amount' => $object->getAmount() / 100, 'currency' => $object->getCurrency()->getName() ]; } diff --git a/test/Hydrator/MoneyHydratorTest.php b/test/Hydrator/MoneyHydratorTest.php index b21b793..5e017c0 100644 --- a/test/Hydrator/MoneyHydratorTest.php +++ b/test/Hydrator/MoneyHydratorTest.php @@ -21,7 +21,7 @@ public function testHydratorExtractAsExpected() $object = new Money(500, new Currency('BRL')); $hydrator = new MoneyHydrator(); $extracted = $hydrator->extract($object); - $expected = ['amount' => $object->getAmount(), 'currency' => $object->getCurrency()->getName()]; + $expected = ['amount' => 5, 'currency' => $object->getCurrency()->getName()]; $this->assertEquals($expected, $extracted); }