Code Duplication    Length = 9-11 lines in 2 locations

tests/phpunit/tests/user/capabilities.php 2 locations

@@ 475-483 (lines=9) @@
472
			// make sure the role name is correct
473
			$this->assertEquals( array( $role ), $user->roles, "User should only have the {$role} role" );
474
475
			foreach ( $caps as $cap => $roles ) {
476
				if ( in_array( $role, $roles, true ) ) {
477
					$this->assertTrue( $user->has_cap( $cap ), "User with the {$role} role should have the {$cap} capability" );
478
					$this->assertTrue( user_can( $user, $cap ), "User with the {$role} role should have the {$cap} capability" );
479
				} else {
480
					$this->assertFalse( $user->has_cap( $cap ), "User with the {$role} role should not have the {$cap} capability" );
481
					$this->assertFalse( user_can( $user, $cap ), "User with the {$role} role should not have the {$cap} capability" );
482
				}
483
			}
484
485
		}
486
@@ 516-526 (lines=11) @@
513
		update_option( 'link_manager_enabled', '1' );
514
		$this->assertSame( '1', get_option( 'link_manager_enabled' ) );
515
516
		foreach ( self::$users as $role => $user ) {
517
			foreach ( $caps as $cap => $roles ) {
518
				if ( in_array( $role, $roles, true ) ) {
519
					$this->assertTrue( $user->has_cap( $cap ), "User with the {$role} role should have the {$cap} capability" );
520
					$this->assertTrue( user_can( $user, $cap ), "User with the {$role} role should have the {$cap} capability" );
521
				} else {
522
					$this->assertFalse( $user->has_cap( $cap ), "User with the {$role} role should not have the {$cap} capability" );
523
					$this->assertFalse( user_can( $user, $cap ), "User with the {$role} role should not have the {$cap} capability" );
524
				}
525
			}
526
		}
527
528
		update_option( 'link_manager_enabled', '0' );
529
		$this->assertSame( '0', get_option( 'link_manager_enabled' ) );