/** * Gets the fractional part of the provided amount * * @param Amount $amount * * @return string */ protected function getFractionalPart(Amount $amount) { $number = new Number($amount->getNumber()->getSubunits()); //if the subunit format is numbers, we want to simply return a fraction if ($amount->getSubunitFormat()->getFormat() === SubunitFormat::NUMBERS) { return $number->getValue() . '/100'; } $unitName = $this->currencyDictionary->getSubunitName($amount->getCurrency(), !$this->isSingular($number)); return $this->numberTransformer->toWords($number) . ' ' . $unitName; }
/** * @dataProvider providerToWords */ public function testToWords($expectedValue, Number $number) { $this->assertEquals($expectedValue, $this->transformer->toWords($number)); }