Code Duplication    Length = 11-13 lines in 3 locations

Tests/Security/Authentication/LdapAuthenticationProviderTest.php 3 locations

@@ 121-133 (lines=13) @@
118
        $this->assertValidAuthenticatedToken($authenticatedToken, $user);
119
    }
120
121
    public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithoutOriginalCredentials()
122
    {
123
        $password = 'password';
124
        $user = $this->createUserMock();
125
126
        $token = $this->createToken($user, $password);
127
128
        $this->willBind($user, $password);
129
130
        $authenticatedToken = $this->ldapAuthenticationProvider->authenticate($token);
131
132
        $this->assertValidAuthenticatedToken($authenticatedToken, $user);
133
    }
134
135
    /**
136
     * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
@@ 169-180 (lines=12) @@
166
     * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
167
     * @expectedExceptionMessage The presented password is invalid.
168
     */
169
    public function testCheckAuthenticationUnknownUserBadCredentials()
170
    {
171
        $username = 'test_username';
172
        $password = 'bad_password';
173
        $user = $this->createUserMock();
174
        $token = $this->createToken($username, $password);
175
176
        $this->willRetrieveUser($username, $user);
177
        $this->willBind($user, $password, false);
178
179
        $this->ldapAuthenticationProvider->authenticate($token);
180
    }
181
182
    /**
183
     * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
@@ 186-196 (lines=11) @@
183
     * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
184
     * @expectedExceptionMessage The presented password cannot be empty.
185
     */
186
    public function testCheckAuthenticationUnknownUserPasswordEmpty()
187
    {
188
        $username = 'test_username';
189
        $password = '';
190
        $user = $this->createUserMock();
191
192
        $this->willRetrieveUser($username, $user);
193
        $token = $this->createToken($username, $password);
194
195
        $this->ldapAuthenticationProvider->authenticate($token);
196
    }
197
198
    /**
199
     * @return UserInterface|\PHPUnit_Framework_MockObject_MockObject