Changeset 25373
- Timestamp:
- 09/12/2013 03:53:56 AM (11 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/actions.php
r25002 r25373 20 20 $this->assertEquals(array($tag), $a->get_tags()); 21 21 22 $args = array_pop($a->get_args()); 22 $argsvar = $a->get_args(); 23 $args = array_pop( $argsvar ); 23 24 $this->assertEquals(array(''), $args); 24 25 } … … 44 45 45 46 function test_has_action() { 46 47 48 49 50 51 52 53 54 55 56 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) ); 57 58 } 58 59 … … 83 84 do_action($tag, $val); 84 85 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 ) ); 87 90 } 88 91 … … 100 103 do_action($tag, $val1, $val2); 101 104 105 $call_count = $a1->get_call_count(); 102 106 // 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 ) ); 105 110 106 111 // a2 should be called with one only 107 112 $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 ) ); 109 115 } 110 116
Note: See TracChangeset
for help on using the changeset viewer.