mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This ensures that not only the return values match the expected results, but also that their type is the same. Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable. Props johnbillion, jrf, SergeyBiryukov. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48937 602fd350-edb4-49c9-b593-d223f7449a82
27 lines
641 B
PHP
27 lines
641 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->assertSame( 2, $a->get_call_count() );
|
|
}
|
|
}
|