Make WordPress Core


Ignore:
Timestamp:
07/31/2022 09:35:40 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r53806 r53808  
    332332         */
    333333        public function test_action_keyed_array() {
    334                 $a = new MockAction();
    335 
     334                $a         = new MockAction();
    336335                $hook_name = __FUNCTION__;
    337336
    … …  
    362361         */
    363362        public function test_action_closure() {
    364                 $hook_name = 'test_action_closure';
     363                $hook_name = __FUNCTION__;
    365364                $closure   = static function( $a, $b ) {
    366365                        $GLOBALS[ $a ] = $b;
    … …  
    375374                $this->assertSame( $GLOBALS[ $context[0] ], $context[1] );
    376375
    377                 $hook_name2 = 'test_action_closure_2';
     376                $hook_name2 = __FUNCTION__ . '_2';
    378377                $closure2   = static function() {
    379378                        $GLOBALS['closure_no_args'] = true;
    … …  
    389388                remove_action( $hook_name, $closure );
    390389                remove_action( $hook_name2, $closure2 );
     390        }
     391
     392        /**
     393         * @ticket 23265
     394         *
     395         * @covers ::add_action
     396         */
     397        public function test_action_callback_representations() {
     398                $hook_name = __FUNCTION__;
     399
     400                $this->assertFalse( has_action( $hook_name ) );
     401
     402                add_action( $hook_name, array( 'Class', 'method' ) );
     403
     404                $this->assertSame( 10, has_action( $hook_name, array( 'Class', 'method' ) ) );
     405
     406                $this->assertSame( 10, has_action( $hook_name, 'Class::method' ) );
    391407        }
    392408
Note: See TracChangeset for help on using the changeset viewer.