View source
<?php
class IntervalUnitTestCase extends DrupalUnitTestCase {
public static function getInfo() {
return array(
'name' => 'Interval unit test',
'description' => 'Test interval works properly.',
'group' => 'Interval',
);
}
public function testInterval() {
date_default_timezone_set('America/Vancouver');
$date = new DateTime();
$date
->setTimestamp(1488344797);
$item = [
'interval' => 1,
'period' => 'month',
];
interval_apply_interval($date, $item, TRUE);
$time = $date
->format('U');
$this
->assertEqual($time, '1491019597', 'March 31st 21:06:37');
}
}