Code Duplication    Length = 16-16 lines in 2 locations

eZ/Publish/API/Repository/Tests/UserServiceTest.php 2 locations

@@ 1879-1894 (lines=16) @@
1876
     * @expectedExceptionMessage Argument 'password' is invalid: Password doesn't match the following rules: User password must be at least 8 characters long, User password must include at least one upper case letter, User password must include at least one number, User password must include at least one special character
1877
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
1878
     */
1879
    public function testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException()
1880
    {
1881
        $userService = $this->getRepository()->getUserService();
1882
1883
        $user = $this->createUserWithPassword('H@xxxiR!_1', $this->createUserWithStrongPasswordContentType());
1884
1885
        /* BEGIN: Use Case */
1886
        // Create a new update struct instance
1887
        $userUpdate = $userService->newUserUpdateStruct();
1888
        $userUpdate->password = 'pass';
1889
1890
        // This call will fail with a "UserPasswordValidationException" because the
1891
        // the password does not follow specified rules
1892
        $userService->updateUser($user, $userUpdate);
1893
        /* END: Use Case */
1894
    }
1895
1896
    /**
1897
     * Opposite test case for testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException.
@@ 1901-1916 (lines=16) @@
1898
     *
1899
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
1900
     */
1901
    public function testUpdateUserWithStrongPassword()
1902
    {
1903
        $userService = $this->getRepository()->getUserService();
1904
1905
        $user = $this->createUserWithPassword('H@xxxiR!_1', $this->createUserWithStrongPasswordContentType());
1906
1907
        /* BEGIN: Use Case */
1908
        // Create a new update struct instance
1909
        $userUpdate = $userService->newUserUpdateStruct();
1910
        $userUpdate->password = 'H@xxxiR!_2';
1911
1912
        $user = $userService->updateUser($user, $userUpdate);
1913
        /* END: Use Case */
1914
1915
        $this->assertInstanceOf(User::class, $user);
1916
    }
1917
1918
    /**
1919
     * Test for the loadUserGroupsOfUser() method.