Make WordPress Core

Changeset 25373


Ignore:
Timestamp:
09/12/2013 03:53:56 AM (11 years ago)
Author:
wonderboymusic
Message:

Fix the PHP 5.4 Only variables should be passed by reference notices in tests/action.php.

See #25282.

Location:
trunk/tests/phpunit
Files:
2 edited

Legend:

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

    r25002 r25373  
    2020        $this->assertEquals(array($tag), $a->get_tags());
    2121
    22         $args = array_pop($a->get_args());
     22        $argsvar = $a->get_args();
     23        $args = array_pop( $argsvar );
    2324        $this->assertEquals(array(''), $args);
    2425    }
     
    4445
    4546    function test_has_action() {
    46             $tag = rand_str();
    47             $func = rand_str();
    48 
    49             $this->assertFalse( has_action($tag, $func) );
    50             $this->assertFalse( has_action($tag) );
    51             add_action($tag, $func);
    52             $this->assertEquals( 10, has_action($tag, $func) );
    53             $this->assertTrue( has_action($tag) );
    54             remove_action($tag, $func);
    55             $this->assertFalse( has_action($tag, $func) );
    56             $this->assertFalse( has_action($tag) );
     47        $tag = rand_str();
     48        $func = rand_str();
     49
     50        $this->assertFalse( has_action($tag, $func) );
     51        $this->assertFalse( has_action($tag) );
     52        add_action($tag, $func);
     53        $this->assertEquals( 10, has_action($tag, $func) );
     54        $this->assertTrue( has_action($tag) );
     55        remove_action($tag, $func);
     56        $this->assertFalse( has_action($tag, $func) );
     57        $this->assertFalse( has_action($tag) );
    5758    }
    5859
     
    8384        do_action($tag, $val);
    8485
    85         $this->assertEquals(1, $a->get_call_count());
    86         $this->assertEquals(array($val), array_pop($a->get_args()));
     86        $call_count = $a->get_call_count();
     87        $this->assertEquals(1, $call_count);
     88        $argsvar = $a->get_args();
     89        $this->assertEquals( array( $val ), array_pop( $argsvar ) );
    8790    }
    8891
     
    100103        do_action($tag, $val1, $val2);
    101104
     105        $call_count = $a1->get_call_count();
    102106        // a1 should be called with both args
    103         $this->assertEquals(1, $a1->get_call_count());
    104         $this->assertEquals(array($val1, $val2), array_pop($a1->get_args()));
     107        $this->assertEquals(1, $call_count);
     108        $argsvar1 = $a1->get_args();
     109        $this->assertEquals( array( $val1, $val2 ), array_pop( $argsvar1 ) );
    105110
    106111        // a2 should be called with one only
    107112        $this->assertEquals(1, $a2->get_call_count());
    108         $this->assertEquals(array($val1), array_pop($a2->get_args()));
     113        $argsvar2 = $a2->get_args();
     114        $this->assertEquals( array( $val1 ), array_pop( $argsvar2 ) );
    109115    }
    110116
Note: See TracChangeset for help on using the changeset viewer.