/** * @setUp */ public function setUp() { $this->builder = new DateTimeFormatterBuilder(); $this->dta = ZonedDateTime::ofDateTime(LocalDateTime::of(2011, 6, 30, 12, 30, 40, 0), ZoneId::of("Europe/Paris")); $this->locale = Locale::of("en"); $this->decimalStyle = DecimalStyle::STANDARD(); }
public function test_toString_base() { $base = DecimalStyle::STANDARD(); $this->assertEquals($base->__toString(), "DecimalStyle[0+-.]"); }
/** * @expectedException \OutOfRangeException */ public function test_parseUnresolved_StringParsePosition_invalidPosition() { $test = $this->fmt->withLocale(Locale::ENGLISH())->withDecimalStyle(DecimalStyle::STANDARD()); $pos = new ParsePosition(6); $test->parseUnresolved("ONE30", $pos); }
public function test_withLocale_same() { $base = (new DateTimeFormatterBuilder())->appendLiteral2("ONE")->appendValue3(ChronoField::DAY_OF_MONTH(), 1, 2, SignStyle::NOT_NEGATIVE())->toFormatter2(Locale::ENGLISH())->withDecimalStyle(DecimalStyle::STANDARD()); $test = $base->withLocale(Locale::ENGLISH()); $this->assertSame($test, $base); }
/** * Completes this builder by creating the formatter. * * @param Locale $locale the locale to use for formatting, not null * @param Chronology|null $chrono the chronology to use, may be null * @return DateTimeFormatter the created formatter, not null */ private function toFormatter4(Locale $locale, ResolverStyle $resolverStyle, $chrono) { while ($this->active->parent !== null) { $this->optionalEnd(); } $pp = new CompositePrinterParser($this->printerParsers, false); return new DateTimeFormatter($pp, $locale, DecimalStyle::STANDARD(), $resolverStyle, null, $chrono, null); }