Make WordPress Core

Changeset 28631


Ignore:
Timestamp:
05/30/2014 05:31:51 PM (12 years ago)
Author:
wonderboymusic
Message:

Adds a unit test to demonstrate that the order of case and default in a switch statement does not matter.

See #27882.

File:
1 edited

Legend:

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

    r28523 r28631  
    160160                $this->assertFalse( isset( $basic->foo ) );
    161161        }
     162
     163        function test_switch_order() {
     164                $return = $this->_switch_order_helper( 1 );
     165                $this->assertEquals( 'match', $return );
     166        }
     167
     168        function _switch_order_helper( $var ) {
     169                $return = 'no match';
     170                switch ( $var ) {
     171                default:
     172                        break;
     173                case 1:
     174                        $return = 'match';
     175                        break;
     176                }
     177
     178                return $return;
     179        }
    162180}
Note: See TracChangeset for help on using the changeset viewer.