WordPress.org

Make WordPress Core

Changeset 41293


Ignore:
Timestamp:
08/22/2017 03:07:42 PM (4 years ago)
Author:
johnbillion
Message:

Build/Test tools: Remove usage of DOING_AJAX from the test suite, so all tests that expect either an Ajax request or a
non-Ajax request can operate without being skipped.

Props Mte90

Fixes #41561

Location:
trunk/tests/phpunit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-ajax.php

    r41119 r41293  
    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' );
  • trunk/tests/phpunit/tests/ajax/Response.php

    r35211 r41293  
    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"
  • trunk/tests/phpunit/tests/customize/manager.php

    r41244 r41293  
    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;
     
    15611559     */
    15621560    function test_not_doing_ajax() {
    1563         if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
    1564             $this->markTestSkipped( 'Cannot test when DOING_AJAX' );
    1565         }
     1561        add_filter( 'wp_doing_ajax', '__return_false' );
    15661562
    15671563        $manager = $this->manager;
  • trunk/tests/phpunit/tests/customize/selective-refresh-ajax.php

    r38858 r41293  
    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
Note: See TracChangeset for help on using the changeset viewer.