Make WordPress Core

Changeset 905 in tests for trunk/tests/actions/closures.php


Ignore:
Timestamp:
07/18/2012 07:37:03 PM (12 years ago)
Author:
nacin
Message:

Update closures tests. Tests_Actions_Closures, don't use rand_str() for tag names, and remove when done so PHPUnit backing up globals doesn't try to serialize a closure.

File:
1 edited

Legend:

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

    r904 r905  
    66 * @group hooks
    77 */
    8 class WP_Test_Actions_Closures extends WP_UnitTestCase {
     8class Tests_Actions_Closures extends WP_UnitTestCase {
    99
    1010    /**
     
    1212     */
    1313    function test_action_closure() {
    14         $tag = rand_str();
     14        $tag = 'test_action_closure';
    1515        $closure = function($a, $b) { $GLOBALS[$a] = $b;};
    1616        add_action($tag, $closure, 10, 2);
     
    2323        $this->assertSame($GLOBALS[$context[0]], $context[1]);
    2424
    25         $tag2 = rand_str();
     25        $tag2 = 'test_action_closure_2';
    2626        $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
    2727        add_action($tag2, $closure2);
     
    3232
    3333        $this->assertTrue($GLOBALS['closure_no_args']);
     34
     35        remove_action( $tag, $closure );
     36        remove_action( $tag2, $closure2 );
    3437    }
    3538}
Note: See TracChangeset for help on using the changeset viewer.