@@ 330-336 (lines=7) @@ | ||
327 | $this->assertInternalType( 'int', get_transient( 'jetpack_other_linked_admins' ) ); |
|
328 | } |
|
329 | ||
330 | public function test_promoting_admin_clears_other_linked_admins_transient() { |
|
331 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |
|
332 | $editor_user = $this->factory->user->create( array( 'role' => 'editor' ) ); |
|
333 | wp_update_user( array( 'ID' => $editor_user, 'role' => 'administrator' ) ); |
|
334 | ||
335 | $this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) ); |
|
336 | } |
|
337 | ||
338 | public function test_demoting_admin_clear_other_linked_admins_transiet() { |
|
339 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |
|
@@ 338-344 (lines=7) @@ | ||
335 | $this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) ); |
|
336 | } |
|
337 | ||
338 | public function test_demoting_admin_clear_other_linked_admins_transiet() { |
|
339 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |
|
340 | $admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) ); |
|
341 | wp_update_user( array( 'ID' => $admin_user, 'role' => 'editor' ) ); |
|
342 | ||
343 | $this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) ); |
|
344 | } |
|
345 | ||
346 | public function test_null_old_roles_clears_linked_admins_transient() { |
|
347 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |
|
@@ 346-355 (lines=10) @@ | ||
343 | $this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) ); |
|
344 | } |
|
345 | ||
346 | public function test_null_old_roles_clears_linked_admins_transient() { |
|
347 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |
|
348 | $admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) ); |
|
349 | wp_update_user( array( 'ID' => $admin_user, 'role' => 'editor' ) ); |
|
350 | ||
351 | /** This action is documented in wp-includes/class-wp-user.php */ |
|
352 | do_action( 'set_user_role', $admin_user, 'contributor' ); |
|
353 | ||
354 | $this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) ); |
|
355 | } |
|
356 | ||
357 | function test_changing_non_admin_roles_does_not_clear_other_linked_admins_transient() { |
|
358 | set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS ); |