• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Tests_Filters::test_filter_priority() –

You appear to be a bot. Output may be restricted

Description

Usage

Tests_Filters::test_filter_priority();

Parameters

Returns

void

Source

File name: wordpress-develop-tests/phpunit/tests/filters.php


Lines:

1 to 31 of 31
  public function test_filter_priority() {
    $a   = new MockAction();
    $tag = __FUNCTION__;
    $val = __FUNCTION__ . '_val';

    // Make two filters with different priorities.
    add_filter( $tag, array( $a, 'filter' ), 10 );
    add_filter( $tag, array( $a, 'filter2' ), 9 );
    $this->assertSame( $val, apply_filters( $tag, $val ) );

    // There should be two events, one per filter.
    $this->assertSame( 2, $a->get_call_count() );

    $expected = array(
      // 'filter2' is called first because it has priority 9.
      array(
        'filter' => 'filter2',
        'tag'    => $tag,
        'args'   => array( $val ),
      ),
      // 'filter' is called second.
      array(
        'filter' => 'filter',
        'tag'    => $tag,
        'args'   => array( $val ),
      ),
    );

    $this->assertSame( $expected, $a->get_events() );
  }
 

 View on GitHub

Published: 26th November 2019 | Last updated: 20th March 2022

Primary Sidebar

Information

Function name: Tests_Filters::test_filter_priority
Class ref: Tests_Filters
Plugin ref: WordPress develop tests
Version: 5.9.3
Sourcefile: phpunit/tests/filters.php
File ref: phpunit/tests/filters.php
Deprecated?: No
API Letters: F,P,T

Footer

WordPress develop tests
WordPress develop tests
WordPress develop tests a2z
WordPress 6.3.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  develop.wp-a2z.org
© Copyright WordPress develop tests 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites