Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 1941-1956 (lines=16) @@
1938
     * @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
1939
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
1940
     */
1941
    public function testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException()
1942
    {
1943
        $userService = $this->getRepository()->getUserService();
1944
1945
        $user = $this->createUserWithPassword('H@xxxiR!_1', $this->createUserWithStrongPasswordContentType());
1946
1947
        /* BEGIN: Use Case */
1948
        // Create a new update struct instance
1949
        $userUpdate = $userService->newUserUpdateStruct();
1950
        $userUpdate->password = 'pass';
1951
1952
        // This call will fail with a "UserPasswordValidationException" because the
1953
        // the password does not follow specified rules
1954
        $userService->updateUser($user, $userUpdate);
1955
        /* END: Use Case */
1956
    }
1957
1958
    /**
1959
     * Opposite test case for testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException.
@@ 1963-1978 (lines=16) @@
1960
     *
1961
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
1962
     */
1963
    public function testUpdateUserWithStrongPassword()
1964
    {
1965
        $userService = $this->getRepository()->getUserService();
1966
1967
        $user = $this->createUserWithPassword('H@xxxiR!_1', $this->createUserWithStrongPasswordContentType());
1968
1969
        /* BEGIN: Use Case */
1970
        // Create a new update struct instance
1971
        $userUpdate = $userService->newUserUpdateStruct();
1972
        $userUpdate->password = 'H@xxxiR!_2';
1973
1974
        $user = $userService->updateUser($user, $userUpdate);
1975
        /* END: Use Case */
1976
1977
        $this->assertInstanceOf(User::class, $user);
1978
    }
1979
1980
    /**
1981
     * Test for the loadUserGroupsOfUser() method.