summaryrefslogtreecommitdiffstats
path: root/Tests/Core/Encoder/BasePasswordEncoderTest.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-10-10 08:30:51 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2013-10-10 14:05:52 +0200
commit41cbe3694a5332d7e5bdb285c81bbfe23f31a220 (patch)
tree48b09420b041421ce1ee3e35d21d98ab11e7d793 /Tests/Core/Encoder/BasePasswordEncoderTest.php
parente3a08775fbfb1062167a56e3c5f606b3300d40a8 (diff)
downloadsymfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.zip
symfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.tar.gz
symfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.tar.bz2
[Security] limited the password length passed to encodersv2.2.9
Diffstat (limited to 'Tests/Core/Encoder/BasePasswordEncoderTest.php')
-rw-r--r--Tests/Core/Encoder/BasePasswordEncoderTest.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/Core/Encoder/BasePasswordEncoderTest.php b/Tests/Core/Encoder/BasePasswordEncoderTest.php
index 2ef1dcc..762f6ab 100644
--- a/Tests/Core/Encoder/BasePasswordEncoderTest.php
+++ b/Tests/Core/Encoder/BasePasswordEncoderTest.php
@@ -53,6 +53,12 @@ class BasePasswordEncoderTest extends \PHPUnit_Framework_TestCase
$this->invokeMergePasswordAndSalt('password', '{foo}');
}
+ public function testIsPasswordTooLong()
+ {
+ $this->assertTrue($this->invokeIsPasswordTooLong(str_repeat('a', 10000)));
+ $this->assertFalse($this->invokeIsPasswordTooLong(str_repeat('a', 10)));
+ }
+
protected function invokeDemergePasswordAndSalt($password)
{
$encoder = new PasswordEncoder();
@@ -82,4 +88,14 @@ class BasePasswordEncoderTest extends \PHPUnit_Framework_TestCase
return $m->invoke($encoder, $p1, $p2);
}
+
+ protected function invokeIsPasswordTooLong($p)
+ {
+ $encoder = new PasswordEncoder();
+ $r = new \ReflectionObject($encoder);
+ $m = $r->getMethod('isPasswordTooLong');
+ $m->setAccessible(true);
+
+ return $m->invoke($encoder, $p);
+ }
}