You appear to be a bot. Output may be restricted
Description
Test each of the actions that should fire in update_blog_details() depending on the flag and flag value being set. Each action should fire once and should not fire if a flag is already set for the given flag value.
Usage
Tests_Multisite_UpdateBlogDetails::test_update_blog_details_flag_action( $flag, $flag_value, $hook );
Parameters
- $flag
- ( string ) required – The name of the flag being set or unset on a site.
- $flag_value
- ( string ) required – '0' or '1'. The value of the flag being set.
- $hook
- ( mixed ) required –
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/multisite/updateBlogDetails.php
Lines:
1 to 30 of 30
public function test_update_blog_details_flag_action( $flag, $flag_value, $hook ) { global $test_action_counter; $test_action_counter = 0; $blog_id = self::factory()->blog->create(); // Set an initial value of '1' for the flag when '0' is the flag value being tested. if ( '0' === $flag_value ) { update_blog_details( $blog_id, array( $flag => '1' ) ); } add_action( $hook, array( $this, 'action_counter_cb' ), 10 ); update_blog_details( $blog_id, array( $flag => $flag_value ) ); $blog = get_site( $blog_id ); $this->assertSame( $flag_value, $blog->{$flag} ); // The hook attached to this flag should have fired once during update_blog_details(). $this->assertSame( 1, $test_action_counter ); // Update the site to the exact same flag value for this flag. update_blog_details( $blog_id, array( $flag => $flag_value ) ); // The hook attached to this flag should not have fired again. $this->assertSame( 1, $test_action_counter ); remove_action( $hook, array( $this, 'action_counter_cb' ), 10 ); }