Tests failing due to missing SERVER_NAME

This commit is contained in:
Mike Jolley 2016-03-23 15:35:06 +00:00
parent 3205975a24
commit 17d11d76ce
3 changed files with 10 additions and 5 deletions

View File

@ -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';

View File

@ -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

View File

@ -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 );