Skip to content

Commit

Permalink
eliminate code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
crstauf committed Oct 4, 2024
1 parent 4badfa5 commit 138f5c7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
*/
class ActionScheduler_IntervalSchedule_Test extends ActionScheduler_UnitTestCase {
public function test_creation() {
$time = as_get_datetime_object();
$schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS);
$time = as_get_datetime_object();
$schedule = new ActionScheduler_IntervalSchedule( $time, HOUR_IN_SECONDS );
$this->assertEquals( $time, $schedule->get_date() );
$this->assertEquals( $time, $schedule->get_first_date() );
}

public function test_creation_with_first_date() {
$first = as_get_datetime_object();
$time = as_get_datetime_object( '+12 hours' );
$first = as_get_datetime_object();
$time = as_get_datetime_object( '+12 hours' );
$schedule = new ActionScheduler_IntervalSchedule( $time, HOUR_IN_SECONDS, $first );
$this->assertEquals( $time, $schedule->get_date() );
$this->assertEquals( $first, $schedule->get_first_date() );
}

public function test_next() {
$now = time();
$start = $now - 30;
$schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS );
$now = time();
$start = $now - 30;
$schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( "@$start" ), MINUTE_IN_SECONDS );
$this->assertEquals( $start, $schedule->get_date()->getTimestamp() );
$this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->get_next(as_get_datetime_object())->getTimestamp() );
$this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->get_next( as_get_datetime_object() )->getTimestamp() );
$this->assertEquals( $start, $schedule->get_next( as_get_datetime_object( "@$start" ) )->getTimestamp() );
}

public function test_is_recurring() {
$start = time() - 30;
$schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS );
$start = time() - 30;
$schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( "@$start" ), MINUTE_IN_SECONDS );
$this->assertTrue( $schedule->is_recurring() );
}
}

0 comments on commit 138f5c7

Please sign in to comment.