/** * Simple tests. * * @covers \Rentalhost\VanillaCount\Currency\RealCurrency::__construct */ public function testSimple() { static::writeAttribute(RealCurrency::class, 'instances', []); $count = new Count(new PortugueseLocale()); static::assertSame('um real', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois reais', $count->spell(2, Count::SPELLING_CURRENCY)); $count = new Count(new PortugueseLocale(['currencyLocale' => 'en'])); static::assertSame('um real', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois reais', $count->spell(2, Count::SPELLING_CURRENCY)); $count = new Count(new PortugueseLocale(['currencyLocale' => 'es'])); static::assertSame('um real', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois reais', $count->spell(2, Count::SPELLING_CURRENCY)); }
/** * Simple tests. * * @covers \Rentalhost\VanillaCount\Currency\DollarCurrency::__construct */ public function testSimple() { static::writeAttribute(DollarCurrency::class, 'instances', []); $count = new Count(new PortugueseLocale(['currency' => DollarCurrency::class])); static::assertSame('um dólar', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois dólares', $count->spell(2, Count::SPELLING_CURRENCY)); $count = new Count(new PortugueseLocale(['currency' => DollarCurrency::class, 'currencyLocale' => 'en'])); static::assertSame('um dollar', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois dollars', $count->spell(2, Count::SPELLING_CURRENCY)); $count = new Count(new PortugueseLocale(['currency' => DollarCurrency::class, 'currencyLocale' => 'es'])); static::assertSame('um dólar', $count->spell(1, Count::SPELLING_CURRENCY)); static::assertSame('dois dólares', $count->spell(2, Count::SPELLING_CURRENCY)); }
/** * Test number spelling with options. * * @param array $options Options to spelling. * @param int $number Number to spelling. * @param string $expected Spelling expected. * * @covers \Rentalhost\VanillaCount\Locale\EnglishLocale::format * @covers \Rentalhost\VanillaCount\Locale\EnglishLocale::formatType * @covers \Rentalhost\VanillaCount\Locale\EnglishLocale::formatType * * @dataProvider dataSpellCurrency */ public function testSpellCurrency($options, $number, $expected) { $count = new Count(new EnglishLocale($options)); static::assertSame($expected, $count->spell($number, Count::SPELLING_CURRENCY)); }
/** * Test spell method. * * @covers \Rentalhost\VanillaCount\Count::__construct * @covers \Rentalhost\VanillaCount\Count::spell */ public function testSpell() { $count = new Count(new PortugueseLocale()); static::assertSame('zero', $count->spell(0)); static::assertSame('um', $count->spell(1)); }