WordPress.org

Make WordPress Core

Changeset 42381


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

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

Props Frank Klein
Fixes #42277

Location:
trunk/tests/phpunit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/class-basic-object.php

    r38444 r42381  
    77 * @since 4.7.0
    88 */
     9
     10trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' );
    911
    1012/**
  • trunk/tests/phpunit/includes/class-basic-subclass.php

    r38444 r42381  
    88 */
    99
     10trigger_error( __FILE__ . ' is deprecated since version 5.0.0 with no alternative available.' );
     11
    1012/**
    1113 * Class used to test accessing methods and properties.
  • trunk/tests/phpunit/includes/functions.php

    r42343 r42381  
    11<?php
    2 
    3 require_once dirname( __FILE__ ) . '/class-basic-object.php';
    4 require_once dirname( __FILE__ ) . '/class-basic-subclass.php';
    52
    63/**
  • 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.