From d4effd5d6be4390557f37f9f9e1c2669b78f88d0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 22 Apr 2017 20:12:29 +0000 Subject: [PATCH] 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 git-svn-id: https://develop.svn.wordpress.org/trunk@40525 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user/mapMetaCap.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/tests/user/mapMetaCap.php b/tests/phpunit/tests/user/mapMetaCap.php index c01729375d..f98c87b8e0 100644 --- a/tests/phpunit/tests/user/mapMetaCap.php +++ b/tests/phpunit/tests/user/mapMetaCap.php @@ -213,8 +213,10 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase { } function test_unfiltered_html_cap() { - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) - $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' ); + if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) { + $this->assertFalse( DISALLOW_UNFILTERED_HTML ); + } + if ( is_multisite() ) { $this->assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) ); $this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', self::$user_id ) ); @@ -227,16 +229,14 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase { * @ticket 20488 */ function test_file_edit_caps_not_reliant_on_unfiltered_html_constant() { - if ( defined( 'DISALLOW_FILE_MODS' ) || defined( 'DISALLOW_FILE_EDIT' ) ) - $this->markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.'); + $this->assertFalse( defined( 'DISALLOW_FILE_MODS' ) ); + $this->assertFalse( defined( 'DISALLOW_FILE_EDIT' ) ); - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) { - if ( ! DISALLOW_UNFILTERED_HTML ) - $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' ); - } else { + if ( ! defined( 'DISALLOW_UNFILTERED_HTML' ) ) { define( 'DISALLOW_UNFILTERED_HTML', true ); } + $this->assertTrue( DISALLOW_UNFILTERED_HTML ); $this->assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', self::$user_id ) ); $this->assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', self::$user_id ) ); }