Make WordPress Core

Changeset 26370


Ignore:
Timestamp:
11/25/2013 10:49:51 PM (11 years ago)
Author:
wonderboymusic
Message:

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.

Location:
trunk/tests/phpunit/tests
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r25002 r26370  
    9898     */
    9999    function test_json_encode_should_not_encode_special_literal_values() {
     100        if ( ! class_exists( 'WP_JS_Literal' ) ) {
     101            $this->markTestSkipped( "WP_JS_Literal class doesn't exist" );
     102        }
     103
    100104        $literal = new WP_JS_Literal( 'baba()' );
    101105        $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) );
     
    106110     */
    107111    function test_json_encode_should_not_encode_special_literal_values_with_dependencies() {
     112        if ( ! class_exists( 'WP_JS_Literal' ) ) {
     113            $this->markTestSkipped( "WP_JS_Literal class doesn't exist" );
     114        }
     115       
    108116        $literal = new WP_JS_Literal( 'baba()', array( 'dep0', 'dep1' ) );
    109117        $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) );
  • trunk/tests/phpunit/tests/export/class-wp-export-query.php

    r25002 r26370  
    88 */
    99class Test_WP_Export_Query extends WP_UnitTestCase {
     10    function setUp() {
     11        if ( ! class_exists( 'WP_Export_Query' ) ) {
     12            $this->markTestSkipped( "WP_Export_Query class doesn't exist" );
     13        }
     14
     15        parent::setUp();
     16    }
     17
    1018    function test_WP_Export_Query_should_be_initialized_with_an_array() {
    1119        $export = new WP_Export_Query( array( 'author' => 'all' ) );
  • trunk/tests/phpunit/tests/export/functions.export.php

    r25002 r26370  
    88 */
    99class Test_WP_Export_Functions extends WP_UnitTestCase {
     10    function setUp() {
     11        if ( ! function_exists( 'wp_export' ) ) {
     12            $this->markTestSkipped( "wp_export function doesn't exist" );
     13        }
     14
     15        parent::setUp();
     16    }
     17   
    1018    function test_wp_export_returns_wp_error_if_the_writer_throws_Export_exception() {
    1119        $this->assertTrue( is_wp_error( wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Export_Exception' ) ) ) );
  • trunk/tests/phpunit/tests/export/writers.php

    r25002 r26370  
    99class Test_WP_Export_Writers extends WP_UnitTestCase {
    1010    function test_export_returner_returns_all_the_return_values() {
     11        if ( ! class_exists( 'WP_Export_Returner' ) ) {
     12            $this->markTestSkipped( "WP_Export_Returner class doesn't exist" );
     13        }
    1114        $returner = new WP_Export_Returner( $this->get_x_formatter() );
    1215        $this->assertEquals( 'xxx' , $returner->export() );
  • trunk/tests/phpunit/tests/formatting/MapDeep.php

    r25002 r26370  
    55 */
    66class Tests_Formatting_MapDeep extends WP_UnitTestCase {
     7    function setUp() {
     8        if ( ! function_exists( 'map_deep' ) ) {
     9            $this->markTestSkipped( "map_deep function doesn't exist" );
     10        }
     11
     12        parent::setUp();
     13    }
     14
    715    function test_map_deep_with_any_function_over_empty_array_should_return_empty_array() {
    816        $this->assertEquals( array(), map_deep( array( $this, 'return_baba' ), array() ) );
  • trunk/tests/phpunit/tests/iterators.php

    r25002 r26370  
    55 */
    66class Test_WP_Post_IDs_Iterator extends WP_UnitTestCase {
     7    function setUp() {
     8        if ( ! class_exists( 'WP_Post_IDs_Iterator' ) ) {
     9            $this->markTestSkipped( "WP_Post_IDs_Iterator class doesn't exist" );
     10        }
     11
     12        parent::setUp();
     13    }
     14
    715    function test_create() {
    816        new WP_Post_IDs_Iterator( array( 1, 2, 3 ) );
Note: See TracChangeset for help on using the changeset viewer.