Verified Commit 44acbf39 authored by Erick Hitter's avatar Erick Hitter
Browse files

Consistent use of Core's serialize/unserialize functions

parent 776359ae
......@@ -232,7 +232,7 @@ class Main extends Singleton {
return array(
'success' => true,
'message' => sprintf( __( 'Job with action `%1$s` and arguments `%2$s` completed in %3$d seconds.', 'wp-cron-control-revisited' ), $event['action'], serialize( $event['args'] ), $time_end - $time_start ),
'message' => sprintf( __( 'Job with action `%1$s` and arguments `%2$s` completed in %3$d seconds.', 'wp-cron-control-revisited' ), $event['action'], maybe_serialize( $event['args'] ), $time_end - $time_start ),
);
}
......
......@@ -24,7 +24,7 @@ class WPCCR_Cron_Options_CPT_Test extends WP_UnitTestCase {
global $wpdb;
$event = WP_Cron_Control_Revisited_Tests\Utils::create_test_event();
$post_name = sprintf( '%s-%s-%s', $event['timestamp'], md5( $event['action'] ), md5( serialize( $event['args'] ) ) );
$post_name = sprintf( '%s-%s-%s', $event['timestamp'], md5( $event['action'] ), md5( maybe_serialize( $event['args'] ) ) );
$entry = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = %s AND post_status = %s AND post_name = %s LIMIT 1", WP_Cron_Control_Revisited\Cron_Options_CPT::POST_TYPE, WP_Cron_Control_Revisited\Cron_Options_CPT::POST_STATUS, $post_name ) );
......@@ -34,7 +34,7 @@ class WPCCR_Cron_Options_CPT_Test extends WP_UnitTestCase {
$instance = maybe_unserialize( $entry->post_content_filtered );
$this->assertEquals( $event['action'], $instance['action'] );
$this->assertEquals( md5( serialize( $event['args'] ) ), $instance['instance'] );
$this->assertEquals( md5( maybe_serialize( $event['args'] ) ), $instance['instance'] );
WP_Cron_Control_Revisited_Tests\Utils::compare_arrays( $event['args'], $instance['args'], $this );
}
......
......@@ -51,7 +51,7 @@ class WPCCR_REST_API_Test extends WP_UnitTestCase {
array(
'timestamp' => $ev['timestamp'],
'action' => md5( $ev['action'] ),
'instance' => md5( serialize( $ev['args'] ) ),
'instance' => md5( maybe_serialize( $ev['args'] ) ),
),
),
'endpoint' => get_rest_url( null, WP_Cron_Control_Revisited\REST_API_NAMESPACE . '/' . WP_Cron_Control_Revisited\REST_API_ENDPOINT_RUN ),
......@@ -64,7 +64,7 @@ class WPCCR_REST_API_Test extends WP_UnitTestCase {
public function test_run_event() {
$ev = WP_Cron_Control_Revisited_Tests\Utils::create_test_event();
$ev['action'] = md5( $ev['action'] );
$ev['instance'] = md5( serialize( $ev['args'] ) );
$ev['instance'] = md5( maybe_serialize( $ev['args'] ) );
$ev['secret'] = WP_CRON_CONTROL_SECRET;
unset( $ev['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