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
This commit is contained in:
John Blackbourn 2017-12-09 23:08:24 +00:00
parent 61350144fb
commit 07be59d34b
4 changed files with 4 additions and 99 deletions

View File

@ -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
*

View File

@ -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.
*

View File

@ -1,8 +1,5 @@
<?php
require_once dirname( __FILE__ ) . '/class-basic-object.php';
require_once dirname( __FILE__ ) . '/class-basic-subclass.php';
/**
* Resets various `$_SERVER` variables that can get altered during tests.
*/

View File

@ -39,32 +39,6 @@ class Tests_Basic extends WP_UnitTestCase {
$this->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;
}
}