Make WordPress Core

Changeset 40525


Ignore:
Timestamp:
04/22/2017 08:12:29 PM (9 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Replace test skipping with actual assertions when dealing with the DISALLOW_UNFILTERED_HTML, DISALLOW_FILE_MODS, and DISALLOW_FILE_EDIT constants.

If any of these constants are set during testing, they should cause the tests to fail, not to be skipped, otherwise we have a situation where failure conditions are never seen.

See #40533

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/mapMetaCap.php

    r39189 r40525  
    214214
    215215        function test_unfiltered_html_cap() {
    216                 if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
    217                         $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
     216                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
     217                        $this->assertFalse( DISALLOW_UNFILTERED_HTML );
     218                }
     219
    218220                if ( is_multisite() ) {
    219221                        $this->assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
    … …  
    228230         */
    229231        function test_file_edit_caps_not_reliant_on_unfiltered_html_constant() {
    230                 if ( defined( 'DISALLOW_FILE_MODS' ) || defined( 'DISALLOW_FILE_EDIT' ) )
    231                         $this->markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
    232 
    233                 if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
    234                         if ( ! DISALLOW_UNFILTERED_HTML )
    235                                 $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
    236                 } else {
     232                $this->assertFalse( defined( 'DISALLOW_FILE_MODS' ) );
     233                $this->assertFalse( defined( 'DISALLOW_FILE_EDIT' ) );
     234
     235                if ( ! defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
    237236                        define( 'DISALLOW_UNFILTERED_HTML', true );
    238237                }
    239238
     239                $this->assertTrue( DISALLOW_UNFILTERED_HTML );
    240240                $this->assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', self::$user_id ) );
    241241                $this->assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', self::$user_id ) );
Note: See TracChangeset for help on using the changeset viewer.