/**
  * Test format with currency and locale.
  */
 public function testFormatWithCurrency()
 {
     // test de-AT with currency € as prefix
     $formatted = $this->priceFormatter->format(123.45, 3, 'de-AT', '€', PriceFormatter::CURRENCY_LOCATION_PREFIX);
     $this->assertEquals('€ 123,450', $formatted, 'price format with currency for "de-AT" does not match');
     // test en-US with currency $ as suffix
     $formatted = $this->priceFormatter->format(123.45, 2, 'en-US', '$', PriceFormatter::CURRENCY_LOCATION_SUFFIX);
     $this->assertEquals('123.45 $', $formatted, 'price format with currency for "en-US" does not match');
     // test en-US with currency 'null' as suffix - should throw exception
     $this->setExpectedException('Sulu\\Bundle\\PricingBundle\\Pricing\\Exceptions\\PriceFormatterException');
     $this->priceFormatter->format(123.45, 2, 'en-US', null, PriceFormatter::CURRENCY_LOCATION_SUFFIX);
 }
Esempio n. 2
0
 /**
  * @VirtualProperty
  * @SerializedName("totalNetPriceFormatted")
  * @Groups({"Default","cart"})
  *
  * @param string $locale
  *
  * @throws PriceFormatterException
  *
  * @return string
  */
 public function getTotalNetPriceFormatted($locale = null)
 {
     return $this->priceFormatter->format((double) $this->entity->getTotalNetPrice(), null, $locale);
 }
Esempio n. 3
0
 /**
  * @VirtualProperty
  * @SerializedName("totalRecurringTaxesFormatted")
  *
  * @param null|string $locale
  *
  * @throws PriceFormatterException
  *
  * @return float
  */
 public function getTotalRecurringTaxesFormatted($locale = null)
 {
     return $this->priceFormatter->format((double) $this->getTotalRecurringTaxes(), null, $locale);
 }