wordpress-develop/tests/phpunit/tests/hooks/doAllHook.php
John Blackbourn 029bea45b0 Build/Test Tools: Reduce the use of unnecessary randomness in tests.
This increases the overall reliability of the tests.

Props johnillo

Fixes #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@52389 602fd350-edb4-49c9-b593-d223f7449a82
2021-12-19 13:42:37 +00:00

28 lines
643 B
PHP

<?php
/**
* Test the do_all_hook method of WP_Hook
*
* @group hooks
* @covers WP_Hook::do_all_hook
*/
class Tests_Hooks_DoAllHook 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 = 1;
$accepted_args = 2;
$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->assertSame( 2, $a->get_call_count() );
}
}