Make WordPress Core


Ignore:
Timestamp:
12/09/2017 11:08:24 PM (9 years ago)
Author:
johnbillion
Message:

Build/Test tools: Remove unnecessary PHP functionality tests from the test suite.

Props Frank Klein
Fixes #42277

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/basic.php

    r42343 r42381  
    3838                $node = $package_json['engines']['node'];
    3939                $this->assertRegExp( '~^=?\d+\.\d+\.\d+$~', $node, "package.json's node version cannot be a range." );
    40         }
    41 
    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'] );
    6640        }
    6741
     
    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}
Note: See TracChangeset for help on using the changeset viewer.