diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index bd3bc889a2..b1287e936d 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -97,6 +97,10 @@ class Tests_Dependencies_Scripts extends WP_UnitTestCase { * @ticket 22229 */ function test_json_encode_should_not_encode_special_literal_values() { + if ( ! class_exists( 'WP_JS_Literal' ) ) { + $this->markTestSkipped( "WP_JS_Literal class doesn't exist" ); + } + $literal = new WP_JS_Literal( 'baba()' ); $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) ); } @@ -105,6 +109,10 @@ class Tests_Dependencies_Scripts extends WP_UnitTestCase { * @ticket 22229 */ function test_json_encode_should_not_encode_special_literal_values_with_dependencies() { + if ( ! class_exists( 'WP_JS_Literal' ) ) { + $this->markTestSkipped( "WP_JS_Literal class doesn't exist" ); + } + $literal = new WP_JS_Literal( 'baba()', array( 'dep0', 'dep1' ) ); $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) ); } diff --git a/tests/phpunit/tests/export/class-wp-export-query.php b/tests/phpunit/tests/export/class-wp-export-query.php index aa51ea5ac0..0fd90d64ff 100644 --- a/tests/phpunit/tests/export/class-wp-export-query.php +++ b/tests/phpunit/tests/export/class-wp-export-query.php @@ -7,6 +7,14 @@ * @ticket 22435 */ class Test_WP_Export_Query extends WP_UnitTestCase { + function setUp() { + if ( ! class_exists( 'WP_Export_Query' ) ) { + $this->markTestSkipped( "WP_Export_Query class doesn't exist" ); + } + + parent::setUp(); + } + function test_WP_Export_Query_should_be_initialized_with_an_array() { $export = new WP_Export_Query( array( 'author' => 'all' ) ); $this->assertTrue( (bool) $export ); diff --git a/tests/phpunit/tests/export/functions.export.php b/tests/phpunit/tests/export/functions.export.php index fa9acf5c5b..e3b77e7da6 100644 --- a/tests/phpunit/tests/export/functions.export.php +++ b/tests/phpunit/tests/export/functions.export.php @@ -7,6 +7,14 @@ * @ticket 22435 */ class Test_WP_Export_Functions extends WP_UnitTestCase { + function setUp() { + if ( ! function_exists( 'wp_export' ) ) { + $this->markTestSkipped( "wp_export function doesn't exist" ); + } + + parent::setUp(); + } + function test_wp_export_returns_wp_error_if_the_writer_throws_Export_exception() { $this->assertTrue( is_wp_error( wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Export_Exception' ) ) ) ); } diff --git a/tests/phpunit/tests/export/writers.php b/tests/phpunit/tests/export/writers.php index 9e4fb31793..6715d17559 100644 --- a/tests/phpunit/tests/export/writers.php +++ b/tests/phpunit/tests/export/writers.php @@ -8,6 +8,9 @@ */ class Test_WP_Export_Writers extends WP_UnitTestCase { function test_export_returner_returns_all_the_return_values() { + if ( ! class_exists( 'WP_Export_Returner' ) ) { + $this->markTestSkipped( "WP_Export_Returner class doesn't exist" ); + } $returner = new WP_Export_Returner( $this->get_x_formatter() ); $this->assertEquals( 'xxx' , $returner->export() ); } diff --git a/tests/phpunit/tests/formatting/MapDeep.php b/tests/phpunit/tests/formatting/MapDeep.php index 8e000e4cc6..7ed88feae2 100644 --- a/tests/phpunit/tests/formatting/MapDeep.php +++ b/tests/phpunit/tests/formatting/MapDeep.php @@ -4,6 +4,14 @@ * @ticket 22300 */ class Tests_Formatting_MapDeep extends WP_UnitTestCase { + function setUp() { + if ( ! function_exists( 'map_deep' ) ) { + $this->markTestSkipped( "map_deep function doesn't exist" ); + } + + parent::setUp(); + } + function test_map_deep_with_any_function_over_empty_array_should_return_empty_array() { $this->assertEquals( array(), map_deep( array( $this, 'return_baba' ), array() ) ); } diff --git a/tests/phpunit/tests/iterators.php b/tests/phpunit/tests/iterators.php index 869106371c..bd5f0d70b3 100644 --- a/tests/phpunit/tests/iterators.php +++ b/tests/phpunit/tests/iterators.php @@ -4,6 +4,14 @@ * @ticket 22435 */ class Test_WP_Post_IDs_Iterator extends WP_UnitTestCase { + function setUp() { + if ( ! class_exists( 'WP_Post_IDs_Iterator' ) ) { + $this->markTestSkipped( "WP_Post_IDs_Iterator class doesn't exist" ); + } + + parent::setUp(); + } + function test_create() { new WP_Post_IDs_Iterator( array( 1, 2, 3 ) ); }