Skip to content

Commit 07be59d

Browse files
committed
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
1 parent 6135014 commit 07be59d

4 files changed

Lines changed: 4 additions & 99 deletions

File tree

tests/phpunit/includes/class-basic-object.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @since 4.7.0
88
*/
99

10+
trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' );
11+
1012
/**
1113
* Class used to test accessing methods and properties
1214
*

tests/phpunit/includes/class-basic-subclass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @since 4.7.0
88
*/
99

10+
trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' );
11+
1012
/**
1113
* Class used to test accessing methods and properties.
1214
*

tests/phpunit/includes/functions.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
22

3-
require_once dirname( __FILE__ ) . '/class-basic-object.php';
4-
require_once dirname( __FILE__ ) . '/class-basic-subclass.php';
5-
63
/**
74
* Resets various `$_SERVER` variables that can get altered during tests.
85
*/

tests/phpunit/tests/basic.php

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,6 @@ function test_package_json_node_engine( $package_json ) {
3939
$this->assertRegExp( '~^=?\d+\.\d+\.\d+$~', $node, "package.json's node version cannot be a range." );
4040
}
4141

42-
// two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
43-
function test_globals() {
44-
global $test_foo;
45-
$test_foo = array( 'foo', 'bar', 'baz' );
46-
47-
function test_globals_foo() {
48-
unset( $GLOBALS['test_foo'][1] );
49-
}
50-
51-
test_globals_foo();
52-
53-
$this->assertEquals(
54-
$test_foo, array(
55-
0 => 'foo',
56-
2 => 'baz',
57-
)
58-
);
59-
$this->assertEquals( $test_foo, $GLOBALS['test_foo'] );
60-
}
61-
62-
function test_globals_bar() {
63-
global $test_bar;
64-
$test_bar = array( 'a', 'b', 'c' );
65-
$this->assertEquals( $test_bar, $GLOBALS['test_bar'] );
66-
}
67-
6842
// test some helper utility functions
6943

7044
function test_strip_ws() {
@@ -110,74 +84,4 @@ function test_mask_input_value() {
11084
EOF;
11185
$this->assertEquals( $expected, mask_input_value( $in ) );
11286
}
113-
114-
/**
115-
* @ticket 17884
116-
*/
117-
function test_setting_nonexistent_arrays() {
118-
$page = 1;
119-
$field = 'settings';
120-
121-
$empty_array[ $page ][ $field ] = 'foo';
122-
123-
// Assertion not strictly needed; we mainly want to show that a notice is not thrown.
124-
unset( $empty_array[ $page ]['bar']['baz'] );
125-
$this->assertFalse( isset( $empty_array[ $page ]['bar']['baz'] ) );
126-
}
127-
128-
function test_magic_getter() {
129-
$basic = new Basic_Object();
130-
131-
$this->assertEquals( 'bar', $basic->foo );
132-
}
133-
134-
function test_subclass_magic_getter() {
135-
$basic = new Basic_Subclass();
136-
137-
$this->assertEquals( 'bar', $basic->foo );
138-
}
139-
140-
function test_call_method() {
141-
$basic = new Basic_Object();
142-
143-
$this->assertEquals( 'maybe', $basic->callMe() );
144-
}
145-
146-
function test_subclass_call_method() {
147-
$basic = new Basic_Subclass();
148-
149-
$this->assertEquals( 'maybe', $basic->callMe() );
150-
}
151-
152-
function test_subclass_isset() {
153-
$basic = new Basic_Subclass();
154-
155-
$this->assertTrue( isset( $basic->foo ) );
156-
}
157-
158-
function test_subclass_unset() {
159-
$basic = new Basic_Subclass();
160-
161-
unset( $basic->foo );
162-
163-
$this->assertFalse( isset( $basic->foo ) );
164-
}
165-
166-
function test_switch_order() {
167-
$return = $this->_switch_order_helper( 1 );
168-
$this->assertEquals( 'match', $return );
169-
}
170-
171-
function _switch_order_helper( $var ) {
172-
$return = 'no match';
173-
switch ( $var ) {
174-
default:
175-
break;
176-
case 1:
177-
$return = 'match';
178-
break;
179-
}
180-
181-
return $return;
182-
}
18387
}

0 commit comments

Comments
 (0)