When setting `WP_TESTS_FORCE_KNOWN_BUGS` to `true`, it is preferable that some forced tests are still skipped when they call classes or functions that do not exist, producing fatal errors.

Fixes #26248.



git-svn-id: https://develop.svn.wordpress.org/trunk@26370 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-11-25 22:49:51 +00:00
parent e683a6eb84
commit 3c671f031e
6 changed files with 43 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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