WordPress.org

Make WordPress Core

Ticket #21172: add-at-9-unit.patch

File add-at-9-unit.patch, 792 bytes (added by devesine, 6 years ago)
  • tests/test_filters.php

     
    236236                $this->assertFalse( empty($args[0][1]->foo) );
    237237
    238238        }
     239
     240        function _add_at_nine($tag) {
     241                $a = new MockAction();
     242                add_action( $tag, array(&$a, 'filter_append'), 9, 1 );
     243                return $tag;
     244        }
     245
     246        function test_filter_addition_during_filter() {
     247                $tag = rand_str();
     248                $a = new MockAction();
     249
     250                add_action( $tag, array(&$this, '_add_at_nine'), 10, 1 );
     251                add_action( $tag, array(&$a, 'filter_append'), 11, 1 );
     252
     253                $result = apply_filters($tag, $tag);
     254                $this->assertEquals( $result, $tag . '_append', 'priority 9 action should not run after priority 10 action adds it' );
     255
     256        }
    239257}