From 98b79ddf5b7e05d150f66fc3fd6670db8effaed7 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 3 Jan 2017 12:19:03 +0000 Subject: [PATCH] Unit test warnings --- tests/framework/class-wc-api-unit-test-case.php | 3 ++- tests/unit-tests/api/settings.php | 3 ++- tests/unit-tests/settings/register-wp-admin-settings.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/framework/class-wc-api-unit-test-case.php b/tests/framework/class-wc-api-unit-test-case.php index dd71381a655..cd820fe9ece 100644 --- a/tests/framework/class-wc-api-unit-test-case.php +++ b/tests/framework/class-wc-api-unit-test-case.php @@ -30,7 +30,8 @@ class WC_API_Unit_Test_Case extends WC_Unit_Test_Case { $_SERVER['REQUEST_METHOD'] = null; // mock the API server to prevent headers from being sent - $this->mock_server = $this->getMock( 'WC_API_Server', array( 'header' ), array( '/' ) ); + // $this->mock_server = $this->getMock( 'WC_API_Server', array( 'header' ), array( '/' ) ); + $this->mock_server = $this->getMockBuilder( 'WC_API_Server' )->setMethods( array( 'header' ) )->disableOriginalConstructor()->getMock(); WC()->api->register_resources( $this->mock_server ); } diff --git a/tests/unit-tests/api/settings.php b/tests/unit-tests/api/settings.php index 9d6ba84b29a..26359324ebe 100644 --- a/tests/unit-tests/api/settings.php +++ b/tests/unit-tests/api/settings.php @@ -373,7 +373,8 @@ class Settings extends WC_REST_Unit_Test_Case { * @since 2.7.0 */ public function test_get_setting_invalid_setting_type() { - $controller = $this->getMock( 'WC_Rest_Settings_Options_Controller', array( 'get_group_settings', 'is_setting_type_valid' ) ); + // $controller = $this->getMock( 'WC_Rest_Settings_Options_Controller', array( 'get_group_settings', 'is_setting_type_valid' ) ); + $controller = $this->getMockBuilder( 'WC_Rest_Settings_Options_Controller' )->setMethods( array( 'get_group_settings', 'is_setting_type_valid' ) )->getMock(); $controller ->expects( $this->any() ) diff --git a/tests/unit-tests/settings/register-wp-admin-settings.php b/tests/unit-tests/settings/register-wp-admin-settings.php index 42a0d564a80..581640d3084 100644 --- a/tests/unit-tests/settings/register-wp-admin-settings.php +++ b/tests/unit-tests/settings/register-wp-admin-settings.php @@ -21,7 +21,8 @@ class WC_Tests_Register_WP_Admin_Settings extends WC_Unit_Test_Case { public function setUp() { parent::setUp(); - $mock_page = $this->getMock( 'WC_Settings_General' ); + // $mock_page = $this->getMock( 'WC_Settings_General' ); + $mock_page = $this->getMockBuilder( 'WC_Settings_General' )->getMock(); $mock_page ->expects( $this->any() )