コード例 #1
0
 public function eraOf($eraValue)
 {
     return IsoEra::of($eraValue);
 }
コード例 #2
0
ファイル: TCKYearTest.php プロジェクト: celest-time/prototype
 public function test_with()
 {
     $base = Year::of(5);
     $result = $base->with(ChronoField::ERA(), 0);
     $ad = $base->adjust(IsoEra::of(0));
     $this->assertEquals($result, $ad);
     $prolepticYear = IsoChronology::INSTANCE()->prolepticYear(IsoEra::of(0), 5);
     $this->assertEquals($result->get(ChronoField::ERA()), 0);
     $this->assertEquals($result->get(ChronoField::YEAR()), $prolepticYear);
     $this->assertEquals($result->get(ChronoField::YEAR_OF_ERA()), 5);
     $result = $base->with(ChronoField::YEAR(), 10);
     $this->assertEquals($result->get(ChronoField::ERA()), $base->get(ChronoField::ERA()));
     $this->assertEquals($result->get(ChronoField::YEAR()), 10);
     $this->assertEquals($result->get(ChronoField::YEAR_OF_ERA()), 10);
     $result = $base->with(ChronoField::YEAR_OF_ERA(), 20);
     $this->assertEquals($result->get(ChronoField::ERA()), $base->get(ChronoField::ERA()));
     $this->assertEquals($result->get(ChronoField::YEAR()), 20);
     $this->assertEquals($result->get(ChronoField::YEAR_OF_ERA()), 20);
 }