public function testTimeZoneWithTestValueSet() { $notNow = IntlCarbon::parse('2013-07-01 12:00:00', 'America/New_York'); IntlCarbon::setTestNow($notNow); $this->assertSame('2013-07-01T12:00:00-0400', IntlCarbon::parse('now')->toIso8601String()); $this->assertSame('2013-07-01T11:00:00-0500', IntlCarbon::parse('now', 'America/Mexico_City')->toIso8601String()); $this->assertSame('2013-07-01T09:00:00-0700', IntlCarbon::parse('now', 'America/Vancouver')->toIso8601String()); }
public function testDiffForHumansAbsoluteMonths() { IntlCarbon::setTestNow(IntlCarbon::create(2012, 1, 1)); $d = IntlCarbon::now()->subMonths(2); $this->assertSame('2 months', IntlCarbon::now()->diffForHumans($d, true)); $d = IntlCarbon::now()->addMonths(2); $this->assertSame('2 months', IntlCarbon::now()->diffForHumans($d, true)); IntlCarbon::setTestNow(); }