git-subtree-dir: libraries/action-scheduler git-subtree-split: a95f351058eada5e5281faa22e5a40865542e839
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class ActionScheduler_SimpleSchedule_Test
|
|
* @group schedules
|
|
*/
|
|
class ActionScheduler_SimpleSchedule_Test extends ActionScheduler_UnitTestCase {
|
|
public function test_creation() {
|
|
$time = as_get_datetime_object();
|
|
$schedule = new ActionScheduler_SimpleSchedule( $time );
|
|
$this->assertEquals( $time, $schedule->get_date() );
|
|
}
|
|
|
|
public function test_past_date() {
|
|
$time = as_get_datetime_object( '-1 day' );
|
|
$schedule = new ActionScheduler_SimpleSchedule( $time );
|
|
$this->assertEquals( $time, $schedule->get_date() );
|
|
}
|
|
|
|
public function test_future_date() {
|
|
$time = as_get_datetime_object( '+1 day' );
|
|
$schedule = new ActionScheduler_SimpleSchedule( $time );
|
|
$this->assertEquals( $time, $schedule->get_date() );
|
|
}
|
|
|
|
public function test_grace_period_for_next() {
|
|
$time = as_get_datetime_object( '3 seconds ago' );
|
|
$schedule = new ActionScheduler_SimpleSchedule( $time );
|
|
$this->assertEquals( $time, $schedule->get_date() );
|
|
}
|
|
|
|
public function test_is_recurring() {
|
|
$schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '+1 day' ) );
|
|
$this->assertFalse( $schedule->is_recurring() );
|
|
}
|
|
}
|