Verified Commit 985790db authored by Erick Hitter's avatar Erick Hitter
Browse files

Rewrite test to also cover `\WP_Cron_Control_Revisited\collapse_events_array()`

parent f0cae427
......@@ -52,19 +52,15 @@ class WPCCR_Cron_Options_CPT_Test extends WP_UnitTestCase {
$this->assertEquals( $cron['version'], 2 );
// Validate the remaining structure
foreach ( $cron as $timestamp => $timestamp_events ) {
if ( ! is_numeric( $timestamp ) ) {
continue;
}
foreach ( $timestamp_events as $action => $action_instances ) {
$this->assertEquals( $action, $event['action'] );
foreach ( $action_instances as $instance => $instance_args ) {
$this->assertArrayHasKey( 'schedule', $instance_args );
$this->assertArrayHasKey( 'args', $instance_args );
}
}
$cron = \WP_Cron_Control_Revisited\collapse_events_array( $cron );
foreach ( $cron as $single_cron ) {
$this->assertEquals( $single_cron['timestamp'], $event['timestamp'] );
$this->assertEquals( $single_cron['action'], $event['action'] );
$this->assertArrayHasKey( 'args', $single_cron );
$this->assertArrayHasKey( 'schedule', $single_cron['args'] );
$this->assertArrayHasKey( 'args', $single_cron['args'] );
$this->assertEquals( $single_cron['args']['args'], $event['args'] );
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment