WordPress.org

Make WordPress Core

Changeset 292 in tests


Ignore:
Timestamp:
03/11/10 21:57:12 (4 years ago)
Author:
westi
Message:

Add a test for do_action with a single keyed array as its argument. Relates WP#11241.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_actions.php

    r119 r292  
    238238        $this->assertFalse( empty($args[0][0]->foo) ); 
    239239    } 
     240     
     241    function test_action_keyed_array() { 
     242        $this->knownWPBug(11241); 
     243        $a = new MockAction(); 
     244 
     245        $tag = rand_str(); 
     246 
     247        add_action($tag, array(&$a, 'action')); 
     248         
     249        $context = array( rand_str() => rand_str() ); 
     250        do_action($tag, $context); 
     251 
     252        $args = $a->get_args(); 
     253        $this->assertSame($args[0][0], $context); 
     254 
     255        $context2 = array( rand_str() => rand_str(), rand_str() => rand_str() ); 
     256        do_action($tag, $context2); 
     257 
     258        $args = $a->get_args(); 
     259        $this->assertSame($args[1][0], $context2); 
     260         
     261    } 
    240262} 
    241263 
Note: See TracChangeset for help on using the changeset viewer.