• 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_remove_filter() –

You appear to be a bot. Output may be restricted

Description

Usage

Tests_Filters::test_remove_filter();

Parameters

Returns

void

Source

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


Lines:

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

    add_filter( $tag, array( $a, 'filter' ) );
    $this->assertSame( $val, apply_filters( $tag, $val ) );

    // Make sure our hook was called correctly.
    $this->assertSame( 1, $a->get_call_count() );
    $this->assertSame( array( $tag ), $a->get_tags() );

    // Now remove the filter, do it again, and make sure it's not called this time.
    remove_filter( $tag, array( $a, 'filter' ) );
    $this->assertSame( $val, apply_filters( $tag, $val ) );
    $this->assertSame( 1, $a->get_call_count() );
    $this->assertSame( array( $tag ), $a->get_tags() );

  }
 

 View on GitHub

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

Primary Sidebar

Information

Function name: Tests_Filters::test_remove_filter
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,R,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