WordPress.org

Make WordPress Core

Changeset 299 in tests


Ignore:
Timestamp:
05/16/10 08:07:05 (5 years ago)
Author:
westi
Message:

Add a test for actions using closures in PHP 5.3.
See WP#10493

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_actions.php

    r292 r299  
    260260         
    261261    } 
     262 
     263    function test_action_closure() { 
     264        $this->checkAtLeastPHPVersion('5.3'); 
     265        $this->knownWPBug(10493); 
     266 
     267        $tag = rand_str(); 
     268        $closure = function($a, $b) { $GLOBALS[$a] = $b;}; 
     269        add_action($tag, $closure, 10, 2); 
     270 
     271        $this->assertSame( 10, has_action($tag, $closure) ); 
     272         
     273        $context = array( rand_str(), rand_str() ); 
     274        do_action($tag, $context[0], $context[1]); 
     275         
     276        $this->assertSame($GLOBALS[$context[0]], $context[1]); 
     277    } 
     278 
    262279} 
    263280 
Note: See TracChangeset for help on using the changeset viewer.