diff --git a/.travis.yml b/.travis.yml index f5b47e0..45f5a7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,5 @@ install: - bash tests/install-tests.sh wordpress_test root '' 127.0.0.1 latest script: - phpunit - - vendor/bin/phpcs --standard=phpcs.ruleset.xml . +notifications: + email: false diff --git a/inc/class-job.php b/inc/class-job.php index 56c53b9..92ae420 100644 --- a/inc/class-job.php +++ b/inc/class-job.php @@ -115,7 +115,10 @@ protected static function to_instance( $row ) { $job->interval = $row->interval; $job->status = $row->status; - if ( ! empty( $row->schedule ) ) { + if ( ! $row->interval ) { + // One off event. + $job->schedule = false; + } elseif ( ! empty( $row->schedule ) ) { $job->schedule = $row->schedule; } else { $job->schedule = get_schedule_by_interval( $row->interval ); diff --git a/inc/connector/namespace.php b/inc/connector/namespace.php index 6a80446..82c5148 100644 --- a/inc/connector/namespace.php +++ b/inc/connector/namespace.php @@ -204,6 +204,8 @@ function get_cron_array( $value ) { $crons[ $timestamp ][ $hook ][ $key ] = $value; } + ksort( $crons, SORT_NUMERIC ); + // Set the version too $crons['version'] = 2; diff --git a/tests/install-tests.sh b/tests/install-tests.sh index 73bb4c7..12a3874 100755 --- a/tests/install-tests.sh +++ b/tests/install-tests.sh @@ -122,6 +122,15 @@ install_db() { mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA } +# Download and copy the WordPress Core Cron +# tests for Cavalcade to ensure the plugin does +# not change the behaviour. +install_core_cron_tests() { + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/tests/cron.php "$TRAVIS_BUILD_DIR"/tests/class-wp-core-cron.php +} + + install_wp install_test_suite install_db +install_core_cron_tests diff --git a/tests/tests/class-rescheduling.php b/tests/tests/class-rescheduling.php index e746736..b10191a 100644 --- a/tests/tests/class-rescheduling.php +++ b/tests/tests/class-rescheduling.php @@ -8,7 +8,7 @@ * * @ticket 64 */ -class Tests_Core extends WP_UnitTestCase { +class Tests_Rescheduling extends WP_UnitTestCase { function setUp() { parent::setUp(); // make sure the schedule is clear