Fix tests by casting to array

This commit is contained in:
Mike Jolley 2016-12-07 11:37:11 +00:00
parent d9420e01d2
commit 6a7ceab462
1 changed files with 262 additions and 262 deletions

View File

@ -67,7 +67,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
wp_set_current_user( $this->user );
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v1/system_status' ) );
$data = $response->get_data();
$environment = $data['environment'];
$environment = (array) $data['environment'];
// Make sure all expected data is present
$this->assertEquals( 30, count( $environment ) );
@ -88,7 +88,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
wp_set_current_user( $this->user );
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v1/system_status' ) );
$data = $response->get_data();
$database = $data['database'];
$database = (array) $data['database'];
$this->assertEquals( get_option( 'woocommerce_db_version' ), $database['wc_database_version'] );
$this->assertEquals( $wpdb->prefix, $database['database_prefix'] );
@ -110,7 +110,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
update_option( 'active_plugins', array() );
$data = $response->get_data();
$plugins = $data['active_plugins'];
$plugins = (array) $data['active_plugins'];
$this->assertEquals( 1, count( $plugins ) );
$this->assertEquals( 'Hello Dolly', $plugins[0]['name'] );
@ -127,7 +127,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v1/system_status' ) );
$data = $response->get_data();
$theme = $data['theme'];
$theme = (array) $data['theme'];
$this->assertEquals( 13, count( $theme ) );
$this->assertEquals( $active_theme->Name, $theme['name'] );
@ -149,7 +149,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v1/system_status' ) );
$data = $response->get_data();
$settings = $data['settings'];
$settings = (array) $data['settings'];
$this->assertEquals( 10, count( $settings ) );
$this->assertEquals( ( 'yes' === get_option( 'woocommerce_api_enabled' ) ), $settings['api_enabled'] );
@ -167,7 +167,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v1/system_status' ) );
$data = $response->get_data();
$settings = $data['security'];
$settings = (array) $data['security'];
$this->assertEquals( 2, count( $settings ) );
$this->assertEquals( 'https' === substr( get_permalink( wc_get_page_id( 'shop' ) ), 0, 5 ), $settings['secure_connection'] );