Make WordPress Core

Changeset 59017


Ignore:
Timestamp:
09/12/2024 09:39:41 PM (4 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Restore the environment before performing assertions in some canonical tests.

This aims to avoid affecting other tests in case of failure.

Follow-up to [28704], [45133].

See #61608.

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

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical.php

    r57645 r59017  
    431431        $this->go_to( get_permalink( $p ) );
    432432
    433         $url = redirect_canonical( add_query_arg( '%D0%BA%D0%BE%D0%BA%D0%BE%D0%BA%D0%BE', 1, site_url( '/' ) ), false );
    434         $this->assertNull( $url );
     433        $redirect = redirect_canonical( add_query_arg( '%D0%BA%D0%BE%D0%BA%D0%BE%D0%BA%D0%BE', 1, site_url( '/' ) ), false );
    435434
    436435        delete_option( 'page_on_front' );
     436
     437        $this->assertNull( $redirect );
    437438    }
    438439
     
    457458        );
    458459
    459         $url = redirect_canonical( get_term_feed_link( self::$terms['/category/parent/'] ), false );
     460        $redirect = redirect_canonical( get_term_feed_link( self::$terms['/category/parent/'] ), false );
     461
    460462        // Restore original global.
    461463        $GLOBALS['wp_query'] = $global_query;
    462464
    463         $this->assertNull( $url );
     465        $this->assertNull( $redirect );
    464466    }
    465467
  • trunk/tests/phpunit/tests/canonical/https.php

    r56547 r59017  
    6262        $redirect = redirect_canonical( $this->https, false );
    6363
     64        remove_filter( 'home_url', array( $this, 'set_https' ) );
     65
    6466        $this->assertNull( $redirect );
    65 
    66         remove_filter( 'home_url', array( $this, 'set_https' ) );
    6767    }
    6868}
Note: See TracChangeset for help on using the changeset viewer.