public function testFormatOrdinal()
 {
     $result = $this->formatter->formatOrdinal(1, [], [], [], 'en_US');
     // expected result is: 1st but in som versions of ICU 1ˢᵗ is also possible
     $this->assertStringStartsWith('1', $result);
     $this->assertNotEquals('1', $result);
 }
Example #2
0
 /**
  * Formats ordinal number according to locale settings.
  *
  * Options format:
  * array(
  *     'attributes' => array(
  *          <attribute> => <value>,
  *          ...
  *      ),
  *     'textAttributes' => array(
  *          <attribute> => <value>,
  *          ...
  *      ),
  *     'symbols' => array(
  *          <symbol> => <value>,
  *          ...
  *      ),
  *     'locale' => <locale>
  * )
  *
  * @param float $value
  * @param array $options
  * @return string
  */
 public function formatOrdinal($value, array $options = array())
 {
     $attributes = (array) $this->getOption($options, 'attributes', array());
     $textAttributes = (array) $this->getOption($options, 'textAttributes', array());
     $symbols = (array) $this->getOption($options, 'symbols', array());
     $locale = $this->getOption($options, 'locale');
     return $this->formatter->formatOrdinal($value, $attributes, $textAttributes, $symbols, $locale);
 }