From f8dabb5b3513763e88cecd5add9b9e3cdb8e852f Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Tue, 23 May 2017 22:15:08 +0000 Subject: [PATCH] Themes: Skip tests if ReflectionMethod::setAccessible is unavailable See [40825]. git-svn-id: https://develop.svn.wordpress.org/trunk@40826 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/theme/customHeader.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/phpunit/tests/theme/customHeader.php b/tests/phpunit/tests/theme/customHeader.php index 98b2c84e02..f65e932657 100644 --- a/tests/phpunit/tests/theme/customHeader.php +++ b/tests/phpunit/tests/theme/customHeader.php @@ -124,6 +124,10 @@ class Tests_Theme_Custom_Header extends WP_UnitTestCase { $this->assertFalse( has_custom_header() ); $this->assertEmpty( $html ); + // ReflectionMethod::setAccessible is only available in PHP 5.3+ + if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { + return; + } // The container should always be returned in the Customizer preview. $this->_set_customize_previewing( true ); $html = get_custom_header_markup(); @@ -205,6 +209,11 @@ class Tests_Theme_Custom_Header extends WP_UnitTestCase { } function test_header_script_is_enqueued_by_the_custom_header_markup_without_video_when_previewing_in_customizer() { + if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { + $this->markTestSkipped( 'ReflectionMethod::setAccessible is only available in PHP 5.3+' ); + return; + } + $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_true' ) ); $this->_set_customize_previewing( true );