mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Tests: Move the test for action callback representations to the general action tests file.
A separate file in the `actions` directory may have seemed like a good location at the time, but this is the only test left there. For consistency, it is now moved with the other action tests. Follow-up to [1294/tests], [53806]. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@53808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5849d4fafd
commit
299ac4dbb9
@ -331,8 +331,7 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
* @covers ::do_action
|
||||
*/
|
||||
public function test_action_keyed_array() {
|
||||
$a = new MockAction();
|
||||
|
||||
$a = new MockAction();
|
||||
$hook_name = __FUNCTION__;
|
||||
|
||||
add_action( $hook_name, array( &$a, 'action' ) );
|
||||
@ -361,7 +360,7 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
* @covers ::do_action
|
||||
*/
|
||||
public function test_action_closure() {
|
||||
$hook_name = 'test_action_closure';
|
||||
$hook_name = __FUNCTION__;
|
||||
$closure = static function( $a, $b ) {
|
||||
$GLOBALS[ $a ] = $b;
|
||||
};
|
||||
@ -374,7 +373,7 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
|
||||
$this->assertSame( $GLOBALS[ $context[0] ], $context[1] );
|
||||
|
||||
$hook_name2 = 'test_action_closure_2';
|
||||
$hook_name2 = __FUNCTION__ . '_2';
|
||||
$closure2 = static function() {
|
||||
$GLOBALS['closure_no_args'] = true;
|
||||
};
|
||||
@ -390,6 +389,23 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
remove_action( $hook_name2, $closure2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 23265
|
||||
*
|
||||
* @covers ::add_action
|
||||
*/
|
||||
public function test_action_callback_representations() {
|
||||
$hook_name = __FUNCTION__;
|
||||
|
||||
$this->assertFalse( has_action( $hook_name ) );
|
||||
|
||||
add_action( $hook_name, array( 'Class', 'method' ) );
|
||||
|
||||
$this->assertSame( 10, has_action( $hook_name, array( 'Class', 'method' ) ) );
|
||||
|
||||
$this->assertSame( 10, has_action( $hook_name, 'Class::method' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::remove_action
|
||||
*/
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @group hooks
|
||||
*/
|
||||
class Tests_Actions_Callbacks extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 23265
|
||||
*
|
||||
* @covers ::add_action
|
||||
*/
|
||||
public function test_callback_representations() {
|
||||
$hook_name = __FUNCTION__;
|
||||
|
||||
$this->assertFalse( has_action( $hook_name ) );
|
||||
|
||||
add_action( $hook_name, array( 'Class', 'method' ) );
|
||||
|
||||
$this->assertSame( 10, has_action( $hook_name, array( 'Class', 'method' ) ) );
|
||||
|
||||
$this->assertSame( 10, has_action( $hook_name, 'Class::method' ) );
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user