Make WordPress Core

Changeset 103 in tests


Ignore:
Timestamp:
12/04/2007 01:25:08 AM (17 years ago)
Author:
tellyworth
Message:

fix a weird phpunit bug that messed up the GLOBALS reference

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_meta.php

    r81 r103  
    44class WPTestMeta extends WPTestCase {
    55    var $val;
    6 
     6   
    77    function setUp() {
    88        parent::setUp();
     
    1818        $this->assertTrue($this->val);
    1919    }
     20
     21    // two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
     22    function test_globals() {
     23        global $test_foo;
     24        $test_foo = array('foo', 'bar', 'baz');
     25       
     26        function test_globals_foo() {
     27            unset($GLOBALS['test_foo'][1]);
     28        }
     29       
     30        test_globals_foo();
     31       
     32        $this->assertEquals($test_foo, array(0=>'foo', 2=>'baz'));
     33        $this->assertEquals($test_foo, $GLOBALS['test_foo']);
     34    }
     35   
     36    function test_globals_bar() {
     37        global $test_bar;
     38        $test_bar = array('a', 'b', 'c');
     39        $this->assertEquals($test_bar, $GLOBALS['test_bar']);
     40    }
     41   
    2042}
    2143
  • wp-testlib/base.php

    r101 r103  
    1414
    1515class WPTestCase extends PHPUnit_Framework_TestCase {
     16
     17    protected $backupGlobals = FALSE;
    1618
    1719    function setUp() {
Note: See TracChangeset for help on using the changeset viewer.