- Timestamp:
- 11/06/2022 03:54:34 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/updateBlogDetails.php
r52010 r54756 57 57 */ 58 58 public function test_update_blog_details_flag_action( $flag, $flag_value, $hook ) { 59 global $test_action_counter; 60 $test_action_counter = 0; 59 $test_action_counter = new MockAction(); 61 60 62 61 $blog_id = self::factory()->blog->create(); … … 67 66 } 68 67 69 add_action( $hook, array( $t his, 'action_counter_cb' ), 10);68 add_action( $hook, array( $test_action_counter, 'action' ) ); 70 69 71 70 update_blog_details( $blog_id, array( $flag => $flag_value ) ); … … 75 74 76 75 // The hook attached to this flag should have fired once during update_blog_details(). 77 $this->assertSame( 1, $test_action_counter );76 $this->assertSame( 1, $test_action_counter->get_call_count() ); 78 77 79 78 // Update the site to the exact same flag value for this flag. … … 81 80 82 81 // The hook attached to this flag should not have fired again. 83 $this->assertSame( 1, $test_action_counter ); 84 85 remove_action( $hook, array( $this, 'action_counter_cb' ), 10 ); 82 $this->assertSame( 1, $test_action_counter->get_call_count() ); 86 83 } 87 84 … … 97 94 array( 'mature', '0', 'unmature_blog' ), 98 95 ); 99 }100 101 /**102 * Provide a counter to determine that hooks are firing when intended.103 */104 public function action_counter_cb() {105 global $test_action_counter;106 $test_action_counter++;107 96 } 108 97
Note: See TracChangeset
for help on using the changeset viewer.