Beispiel #1
0
 public function testGetSecondsFromInterval()
 {
     $this->assertEquals(1, Duration::getSecondsFromInterval(new DateInterval('PT1S')));
     $this->assertEquals(60, Duration::getSecondsFromInterval(new DateInterval('PT60S')));
     $this->assertEquals(60, Duration::getSecondsFromInterval(new DateInterval('PT1M')));
     $this->assertEquals(3600, Duration::getSecondsFromInterval(new DateInterval('PT60M')));
     $this->assertEquals(3600, Duration::getSecondsFromInterval(new DateInterval('PT1H')));
     $this->assertEquals(86400, Duration::getSecondsFromInterval(new DateInterval('PT24H')));
     $this->assertEquals(86400, Duration::getSecondsFromInterval(new DateInterval('P1D')));
     $this->assertEquals(2592000, Duration::getSecondsFromInterval(new DateInterval('P30D')));
     $this->assertEquals(2592000, Duration::getSecondsFromInterval(new DateInterval('P1M')));
     $this->assertEquals(31104000, Duration::getSecondsFromInterval(new DateInterval('P12M')));
     $this->assertEquals(31536000, Duration::getSecondsFromInterval(new DateInterval('P1Y')));
 }