summaryrefslogtreecommitdiffstats
path: root/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-09-16 14:00:03 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2013-09-23 09:15:09 +0200
commit76e8abad8efbc5a988c1aa566b072d62e083faa9 (patch)
treea38a749cd872a39216b3eaf6f51b752280f320ae /Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
parent38c5dd30d7545490836456062abf49c213b972cb (diff)
downloadsymfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.zip
symfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.tar.gz
symfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.tar.bz2
[Security] limited the password length passed to encoders
Diffstat (limited to 'Core/Tests/Encoder/PlaintextPasswordEncoderTest.php')
-rw-r--r--Core/Tests/Encoder/PlaintextPasswordEncoderTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php b/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
index 513a94a..763aae1 100644
--- a/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
+++ b/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php
@@ -36,4 +36,24 @@ class PlaintextPasswordEncoderTest extends \PHPUnit_Framework_TestCase
$this->assertSame('foo', $encoder->encodePassword('foo', ''));
}
+
+ /**
+ * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
+ */
+ public function testEncodePasswordLength()
+ {
+ $encoder = new PlaintextPasswordEncoder();
+
+ $encoder->encodePassword(str_repeat('a', 5000), 'salt');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
+ */
+ public function testCheckPasswordLength()
+ {
+ $encoder = new PlaintextPasswordEncoder();
+
+ $encoder->isPasswordValid('encoded', str_repeat('a', 5000), 'salt');
+ }
}