/** * @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); }
/** * @dataProvider data_text */ public function test_appendText1arg_format(TemporalField $field, TextStyle $style, $value, $expected) { if ($style == TextStyle::FULL()) { $f = $this->builder->appendText($field)->toFormatter2(Locale::ENGLISH()); $dt = LocalDateTime::of(2010, 1, 1, 0, 0); $dt = $dt->with($field, $value); $text = $f->format($dt); $this->assertEquals($text, $expected); } }
function data_preferredZones() { return [["America/New_York", "Eastern Standard Time", [], Locale::ENGLISH(), TextStyle::FULL()], ["Europe/Paris", "Central European Time", [], Locale::ENGLISH(), TextStyle::FULL()], ["CET", "Central European Time", self::preferred(), Locale::ENGLISH(), TextStyle::FULL()], ["Asia/Shanghai", "China Standard Time", [], Locale::ENGLISH(), TextStyle::FULL()], ["Asia/Taipei", "China Standard Time", self::preferred(), Locale::ENGLISH(), TextStyle::FULL()], ["America/Chicago", "CST", [], Locale::ENGLISH(), TextStyle::SHORT()], ["Asia/Taipei", "CST", self::preferred(), Locale::ENGLISH(), TextStyle::SHORT()], ["Australia/South", "ACST", self::preferred_s(), Locale::ENGLISH(), TextStyle::SHORT()], ["America/Chicago", "CDT", [], Locale::ENGLISH(), TextStyle::SHORT()], ["Asia/Shanghai", "CDT", self::preferred_s(), Locale::ENGLISH(), TextStyle::SHORT()]]; }