WordPress.org

Make WordPress Core

Changeset 295 in tests


Ignore:
Timestamp:
03/31/10 21:36:35 (4 years ago)
Author:
westi
Message:

Improve the test for apply_filters_ref_array to test the result of the filter and show the bug! See WP#12723 pops scribu for the test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_filters.php

    r294 r295  
    211211        $obj = new stdClass(); 
    212212        $a = new MockAction(); 
     213        $b = new MockAction(); 
    213214        $tag = rand_str(); 
    214215 
    215216        add_action($tag, array(&$a, 'filter_append'), 10, 2); 
    216  
     217        add_action($tag, array(&$b, 'filter_append'), 10, 2); 
     218         
    217219        $result = apply_filters_ref_array($tag, array('string', &$obj)); 
    218220 
    219         $this->assertEquals($result, 'string_append'); 
     221        $this->assertEquals($result, 'string_append_append'); 
    220222         
    221223        $args = $a->get_args(); 
    222  
    223224        $this->assertSame($args[0][1], $obj); 
    224225        // just in case we don't trust assertSame 
    225226        $obj->foo = true; 
    226227        $this->assertFalse( empty($args[0][1]->foo) ); 
     228 
     229        $args = $b->get_args(); 
     230        $this->assertSame($args[0][1], $obj); 
     231        // just in case we don't trust assertSame 
     232        $obj->foo = true; 
     233        $this->assertFalse( empty($args[0][1]->foo) ); 
     234         
    227235    } 
    228236} 
Note: See TracChangeset for help on using the changeset viewer.