Code Duplication    Length = 9-10 lines in 2 locations

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

@@ 671-679 (lines=9) @@
668
669
		$caps = $this->getAllCapsAndRoles();
670
671
		foreach ( $caps as $cap => $roles ) {
672
			if ( array_intersect( $user->roles, $roles ) ) {
673
				$this->assertTrue( $user->has_cap( $cap ), "User should have the {$cap} capability" );
674
				$this->assertTrue( user_can( $user, $cap ), "User should have the {$cap} capability" );
675
			} else {
676
				$this->assertFalse( $user->has_cap( $cap ), "User should not have the {$cap} capability" );
677
				$this->assertFalse( user_can( $user, $cap ), "User should not have the {$cap} capability" );
678
			}
679
		}
680
681
		$user->remove_role( 'contributor' );
682
		// user should have one role now
@@ 744-753 (lines=10) @@
741
742
		$caps = $this->getPrimitiveCapsAndRoles();
743
744
		foreach ( $caps as $cap => $roles ) {
745
			// the user should have all the above caps
746
			if ( isset( $expected_caps[ $cap ] ) ) {
747
				$this->assertTrue( $user->has_cap( $cap ), "User should have the {$cap} capability" );
748
				$this->assertTrue( user_can( $user, $cap ), "User should have the {$cap} capability" );
749
			} else {
750
				$this->assertFalse( $user->has_cap( $cap ), "User should not have the {$cap} capability" );
751
				$this->assertFalse( user_can( $user, $cap ), "User should not have the {$cap} capability" );
752
			}
753
		}
754
755
		// clean up
756
		remove_role( $role_name );