diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e4d3b8fdcd2..37619b65ce4 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -28,6 +28,11 @@ class WC_Unit_Tests_Bootstrap { ini_set( 'display_errors','on' ); error_reporting( E_ALL ); + // Ensure server variable is set for WP email functions. + if ( ! isset( $_SERVER['SERVER_NAME'] ) ) { + $_SERVER['SERVER_NAME'] = 'localhost'; + } + $this->tests_dir = dirname( __FILE__ ); $this->plugin_dir = dirname( $this->tests_dir ); $this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib'; diff --git a/tests/framework/class-wc-mock-wc-data.php b/tests/framework/class-wc-mock-wc-data.php index 5898c6851fb..29ac53f1013 100644 --- a/tests/framework/class-wc-mock-wc-data.php +++ b/tests/framework/class-wc-mock-wc-data.php @@ -2,7 +2,7 @@ /** * Used for exposing and testing the various Abstract WC_Data methods. */ -class WC_Mock_WC_data extends WC_Data { +class WC_Mock_WC_Data extends WC_Data { /** * Data array diff --git a/tests/unit-tests/crud/meta.php b/tests/unit-tests/crud/meta.php index f21314b2d0f..7738685d160 100644 --- a/tests/unit-tests/crud/meta.php +++ b/tests/unit-tests/crud/meta.php @@ -10,7 +10,7 @@ class WC_Tests_CRUD_Meta extends WC_Unit_Test_Case { * Create a test post we can add/test meta against. */ public function create_test_post() { - $object = new WC_Mock_WC_data(); + $object = new WC_Mock_WC_Data(); $object->set_content( 'testing' ); $object->save(); return $object; @@ -20,7 +20,7 @@ class WC_Tests_CRUD_Meta extends WC_Unit_Test_Case { * Create a test user we can add/test meta against. */ public function create_test_user() { - $object = new WC_Mock_WC_data(); + $object = new WC_Mock_WC_Data(); $object->set_meta_type( 'user' ); $object->set_object_id_field( 'user_id' ); $object->set_content( 'testing@woo.dev' ); @@ -100,7 +100,7 @@ class WC_Tests_CRUD_Meta extends WC_Unit_Test_Case { ); } - $object = new WC_Mock_WC_data(); + $object = new WC_Mock_WC_Data(); $object->set_meta_data( $metadata ); $this->assertEquals( $metadata, $object->get_meta_data() ); @@ -205,7 +205,7 @@ class WC_Tests_CRUD_Meta extends WC_Unit_Test_Case { * data before a save. */ function test_add_meta_data_overwrite_before_save() { - $object = new WC_Mock_WC_data; + $object = new WC_Mock_WC_Data; $object->add_meta_data( 'test_field_0', 'another field', true ); $object->add_meta_data( 'test_field_1', 'another field', true ); $object->add_meta_data( 'test_field_2', 'val1', true );