public function test_London_getTransitionRules() { $test = $this->europeLondon(); $rules = $test->getTransitionRules(); $this->assertEquals(count($rules), 2); $in = $rules[0]; $this->assertEquals($in->getMonth(), Month::MARCH()); $this->assertEquals($in->getDayOfMonthIndicator(), 25); // optimized from -1 $this->assertEquals($in->getDayOfWeek(), DayOfWeek::SUNDAY()); $this->assertEquals($in->getLocalTime(), LocalTime::of(1, 0)); $this->assertEquals($in->getTimeDefinition(), TimeDefinition::UTC()); $this->assertEquals($in->getStandardOffset(), self::$OFFSET_ZERO); $this->assertEquals($in->getOffsetBefore(), self::$OFFSET_ZERO); $this->assertEquals($in->getOffsetAfter(), self::$OFFSET_PONE); $out = $rules[1]; $this->assertEquals($out->getMonth(), Month::OCTOBER()); $this->assertEquals($out->getDayOfMonthIndicator(), 25); // optimized from -1 $this->assertEquals($out->getDayOfWeek(), DayOfWeek::SUNDAY()); $this->assertEquals($out->getLocalTime(), LocalTime::of(1, 0)); $this->assertEquals($out->getTimeDefinition(), TimeDefinition::UTC()); $this->assertEquals($out->getStandardOffset(), self::$OFFSET_ZERO); $this->assertEquals($out->getOffsetBefore(), self::$OFFSET_PONE); $this->assertEquals($out->getOffsetAfter(), self::$OFFSET_ZERO); }
public function test_toString_fixedDate() { $test = ZoneOffsetTransitionRule::of(Month::MARCH(), 20, null, self::TIME_0100(), false, TimeDefinition::STANDARD(), self::OFFSET_0200(), self::OFFSET_0200(), self::OFFSET_0300()); $this->assertEquals($test->__toString(), "TransitionRule[Gap +02:00 to +03:00, MARCH 20 at 01:00 STANDARD, standard offset +02:00]"); }
function data_adjustInto() { return [[LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::of(2012, 3, 4, 1, 1, 1, 100), LocalDateTime::of(2012, 3, 4, 23, 5, 0, 0), null], [LocalDateTime::ofMonth(2012, Month::MARCH(), 4, 0, 0), LocalDateTime::of(2012, 3, 4, 1, 1, 1, 100), LocalDateTime::of(2012, 3, 4, 0, 0), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MAX(), LocalDateTime::of(2012, 3, 4, 23, 5), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MIN(), LocalDateTime::of(2012, 3, 4, 23, 5), null], [LocalDateTime::MAX(), LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MAX(), null], [LocalDateTime::MIN(), LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MIN(), null], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetDateTime::of(2210, 2, 2, 0, 0, 0, 0, ZoneOffset::UTC()), OffsetDateTime::of(2012, 3, 4, 23, 5, 0, 0, ZoneOffset::UTC()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetDateTime::of(2210, 2, 2, 0, 0, 0, 0, self::OFFSET_PONE()), OffsetDateTime::of(2012, 3, 4, 23, 5, 0, 0, self::OFFSET_PONE()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), ZonedDateTime::of(2210, 2, 2, 0, 0, 0, 0, self::ZONE_PARIS()), ZonedDateTime::of(2012, 3, 4, 23, 5, 0, 0, self::ZONE_PARIS()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDate::of(2210, 2, 2), null, DateTimeException::class], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalTime::of(22, 3, 0), null, DateTimeException::class], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetTime::of(22, 3, 0, 0, ZoneOffset::UTC()), null, DateTimeException::class]]; }
public function test_toString() { $this->assertEquals(Month::JANUARY()->__toString(), "JANUARY"); $this->assertEquals(Month::FEBRUARY()->__toString(), "FEBRUARY"); $this->assertEquals(Month::MARCH()->__toString(), "MARCH"); $this->assertEquals(Month::APRIL()->__toString(), "APRIL"); $this->assertEquals(Month::MAY()->__toString(), "MAY"); $this->assertEquals(Month::JUNE()->__toString(), "JUNE"); $this->assertEquals(Month::JULY()->__toString(), "JULY"); $this->assertEquals(Month::AUGUST()->__toString(), "AUGUST"); $this->assertEquals(Month::SEPTEMBER()->__toString(), "SEPTEMBER"); $this->assertEquals(Month::OCTOBER()->__toString(), "OCTOBER"); $this->assertEquals(Month::NOVEMBER()->__toString(), "NOVEMBER"); $this->assertEquals(Month::DECEMBER()->__toString(), "DECEMBER"); }