Make WordPress Core

Ticket #41561: 41561.2.diff

File 41561.2.diff, 3.0 KB (added by Mte90, 7 years ago)

removed marktestskipped

  • tests/phpunit/includes/testcase-ajax.php

    diff --git tests/phpunit/includes/testcase-ajax.php tests/phpunit/includes/testcase-ajax.php
    index 930ac4d3c4..2227413511 100644
    abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase { 
    5959        );
    6060
    6161        public static function setUpBeforeClass() {
    62                 if ( ! defined( 'DOING_AJAX' ) ) {
    63                         define( 'DOING_AJAX', true );
    64                 }
     62                add_filter( 'wp_doing_ajax', '__return_true' );         
    6563
    6664                remove_action( 'admin_init', '_maybe_update_core' );
    6765                remove_action( 'admin_init', '_maybe_update_plugins' );
  • tests/phpunit/tests/ajax/Response.php

    diff --git tests/phpunit/tests/ajax/Response.php tests/phpunit/tests/ajax/Response.php
    index bc99341fb0..b08b716313 100644
    class Tests_Ajax_Response extends WP_UnitTestCase { 
    2323                parent::setUp();
    2424
    2525                add_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
    26                 if ( !defined( 'DOING_AJAX' ) )
    27                         define( 'DOING_AJAX', true );
     26                add_filter( 'wp_doing_ajax', '__return_true' );
    2827
    2928                // Suppress warnings from "Cannot modify header information - headers already sent by"
    3029                $this->_error_level = error_reporting();
  • tests/phpunit/tests/customize/manager.php

    diff --git tests/phpunit/tests/customize/manager.php tests/phpunit/tests/customize/manager.php
    index 36905e292d..0f64400c00 100644
    class Tests_WP_Customize_Manager extends WP_UnitTestCase { 
    15441544         * @group ajax
    15451545         */
    15461546        function test_doing_ajax() {
    1547                 if ( ! defined( 'DOING_AJAX' ) ) {
    1548                         define( 'DOING_AJAX', true );
    1549                 }
     1547                add_filter( 'wp_doing_ajax', '__return_true' );
    15501548
    15511549                $manager = $this->manager;
    15521550                $this->assertTrue( $manager->doing_ajax() );
    class Tests_WP_Customize_Manager extends WP_UnitTestCase { 
    15601558         * Test ! WP_Customize_Manager::doing_ajax().
    15611559         */
    15621560        function test_not_doing_ajax() {
    1563                 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
    1564                         $this->markTestSkipped( 'Cannot test when DOING_AJAX' );
    1565                 }
    1566 
    15671561                $manager = $this->manager;
    15681562                $this->assertFalse( $manager->doing_ajax() );
    15691563        }
  • tests/phpunit/tests/customize/selective-refresh-ajax.php

    diff --git tests/phpunit/tests/customize/selective-refresh-ajax.php tests/phpunit/tests/customize/selective-refresh-ajax.php
    index 35ac86c281..f7fdb2b9ed 100644
    class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { 
    3737        function setUp() {
    3838                parent::setUp();
    3939
    40                 // Define DOING_AJAX so that wp_die() will be used instead of die().
    41                 if ( ! defined( 'DOING_AJAX' ) ) {
    42                         define( 'DOING_AJAX', true );
    43                 }
     40                // Define wp_doing_ajax so that wp_die() will be used instead of die().
     41                add_filter( 'wp_doing_ajax', '__return_true' );
    4442                add_filter( 'wp_die_ajax_handler', array( $this, 'get_wp_die_handler' ), 1, 1 );
    4543
    4644                require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );