wordpress-develop/tests/phpunit/tests/hooks/doAllHook.php
Gary Pendergast 8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00

27 lines
643 B
PHP

<?php
/**
* Test the do_all_hook method of WP_Hook
*
* @group hooks
*/
class Tests_WP_Hook_Do_All_Hook extends WP_UnitTestCase {
public function test_do_all_hook_with_multiple_calls() {
$a = new MockAction();
$callback = array( $a, 'action' );
$hook = new WP_Hook();
$tag = 'all';
$priority = rand( 1, 100 );
$accepted_args = rand( 1, 100 );
$arg = 'all_arg';
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
$args = array( $arg );
$hook->do_all_hook( $args );
$hook->do_all_hook( $args );
$this->assertEquals( 2, $a->get_call_count() );
}
}