/**
  * @dataProvider data_time
  */
 public function test_time_parse(LocalTime $time, FormatStyle $timeStyle, $timeStyleOld, Locale $locale)
 {
     $old = \IntlDateFormatter::create($locale->getLocale(), \IntlDateFormatter::NONE, $timeStyleOld, new \DateTimeZone('UTC'));
     $oldDate = new \DateTime('1970-0-0T' . $time->getHour() . ':' . $time->getMinute() . ':' . $time->getSecond(), new \DateTimeZone('UTC'));
     $text = $old->format($oldDate);
     $f = $this->builder->appendLocalized(null, $timeStyle)->toFormatter2($locale);
     $parsed = $f->parsePos($text, $this->pos);
     $this->assertEquals($this->pos->getIndex(), strlen($text));
     $this->assertEquals($this->pos->getErrorIndex(), -1);
     $this->assertEquals(LocalTime::from($parsed), $time);
 }
예제 #2
0
 /**
  * @dataProvider data_formatStyle
  */
 public function test_formatStyle(Temporal $temporal, FormatStyle $style, $formattedStr)
 {
     $this->markTestIncomplete('ZoneTextPrinterParser, Localized Zone Names');
     $builder = new DateTimeFormatterBuilder();
     $formatter = $builder->appendLocalized($style, $style)->appendLiteral(" ")->appendZoneOrOffsetId()->toFormatter();
     $formatter = $formatter->withLocale(Locale::US());
     $this->assertEquals($formattedStr, $formatter->format($temporal));
 }