From 07be59d34bcceaeee8fe850bcdb6324e71b862b7 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Dec 2017 23:08:24 +0000 Subject: [PATCH] Build/Test tools: Remove unnecessary PHP functionality tests from the test suite. Props Frank Klein Fixes #42277 git-svn-id: https://develop.svn.wordpress.org/trunk@42381 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/class-basic-object.php | 2 + .../phpunit/includes/class-basic-subclass.php | 2 + tests/phpunit/includes/functions.php | 3 - tests/phpunit/tests/basic.php | 96 ------------------- 4 files changed, 4 insertions(+), 99 deletions(-) diff --git a/tests/phpunit/includes/class-basic-object.php b/tests/phpunit/includes/class-basic-object.php index a85a9f6596..f773c94ca1 100644 --- a/tests/phpunit/includes/class-basic-object.php +++ b/tests/phpunit/includes/class-basic-object.php @@ -7,6 +7,8 @@ * @since 4.7.0 */ +trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' ); + /** * Class used to test accessing methods and properties * diff --git a/tests/phpunit/includes/class-basic-subclass.php b/tests/phpunit/includes/class-basic-subclass.php index deb922d681..9a570da147 100644 --- a/tests/phpunit/includes/class-basic-subclass.php +++ b/tests/phpunit/includes/class-basic-subclass.php @@ -7,6 +7,8 @@ * @since 4.7.0 */ +trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' ); + /** * Class used to test accessing methods and properties. * diff --git a/tests/phpunit/includes/functions.php b/tests/phpunit/includes/functions.php index ddaa2b3414..9a450ece84 100644 --- a/tests/phpunit/includes/functions.php +++ b/tests/phpunit/includes/functions.php @@ -1,8 +1,5 @@ assertRegExp( '~^=?\d+\.\d+\.\d+$~', $node, "package.json's node version cannot be a range." ); } - // two tests for a lame bug in PHPUnit that broke the $GLOBALS reference - function test_globals() { - global $test_foo; - $test_foo = array( 'foo', 'bar', 'baz' ); - - function test_globals_foo() { - unset( $GLOBALS['test_foo'][1] ); - } - - test_globals_foo(); - - $this->assertEquals( - $test_foo, array( - 0 => 'foo', - 2 => 'baz', - ) - ); - $this->assertEquals( $test_foo, $GLOBALS['test_foo'] ); - } - - function test_globals_bar() { - global $test_bar; - $test_bar = array( 'a', 'b', 'c' ); - $this->assertEquals( $test_bar, $GLOBALS['test_bar'] ); - } - // test some helper utility functions function test_strip_ws() { @@ -110,74 +84,4 @@ EOF; EOF; $this->assertEquals( $expected, mask_input_value( $in ) ); } - - /** - * @ticket 17884 - */ - function test_setting_nonexistent_arrays() { - $page = 1; - $field = 'settings'; - - $empty_array[ $page ][ $field ] = 'foo'; - - // Assertion not strictly needed; we mainly want to show that a notice is not thrown. - unset( $empty_array[ $page ]['bar']['baz'] ); - $this->assertFalse( isset( $empty_array[ $page ]['bar']['baz'] ) ); - } - - function test_magic_getter() { - $basic = new Basic_Object(); - - $this->assertEquals( 'bar', $basic->foo ); - } - - function test_subclass_magic_getter() { - $basic = new Basic_Subclass(); - - $this->assertEquals( 'bar', $basic->foo ); - } - - function test_call_method() { - $basic = new Basic_Object(); - - $this->assertEquals( 'maybe', $basic->callMe() ); - } - - function test_subclass_call_method() { - $basic = new Basic_Subclass(); - - $this->assertEquals( 'maybe', $basic->callMe() ); - } - - function test_subclass_isset() { - $basic = new Basic_Subclass(); - - $this->assertTrue( isset( $basic->foo ) ); - } - - function test_subclass_unset() { - $basic = new Basic_Subclass(); - - unset( $basic->foo ); - - $this->assertFalse( isset( $basic->foo ) ); - } - - function test_switch_order() { - $return = $this->_switch_order_helper( 1 ); - $this->assertEquals( 'match', $return ); - } - - function _switch_order_helper( $var ) { - $return = 'no match'; - switch ( $var ) { - default: - break; - case 1: - $return = 'match'; - break; - } - - return $return; - } }