Make WordPress Core

Changeset 905 in tests


Ignore:
Timestamp:
07/18/2012 07:37:03 PM (14 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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpunit.xml

    r897 r905  
    99        <testsuite>
    1010            <directory suffix=".php">tests</directory>
    11             <file phpVersion="5.3.0">tests/test_actions_closures.php</file>
     11            <file phpVersion="5.3.0">tests/actions/closures.php</file>
    1212        </testsuite>
    1313    </testsuites>
  • 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.