* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Tests\Encoder; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder; class PlaintextPasswordEncoderTest extends TestCase { public function testIsPasswordValid() { $encoder = new PlaintextPasswordEncoder(); $this->assertTrue($encoder->isPasswordValid('foo', 'foo', '')); $this->assertFalse($encoder->isPasswordValid('bar', 'foo', '')); $this->assertFalse($encoder->isPasswordValid('FOO', 'foo', '')); $encoder = new PlaintextPasswordEncoder(true); $this->assertTrue($encoder->isPasswordValid('foo', 'foo', '')); $this->assertFalse($encoder->isPasswordValid('bar', 'foo', '')); $this->assertTrue($encoder->isPasswordValid('FOO', 'foo', '')); } public function testEncodePassword() { $encoder = new PlaintextPasswordEncoder(); $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'); } public function testCheckPasswordLength() { $encoder = new PlaintextPasswordEncoder(); $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), 'salt')); } } __halt_compiler();----SIGNATURE:----JMFY1h8q+WBlVH6KpfrH+QSOjwhNgwspvclQoNAvifxdyhtVujiG3yMsNxurj5sTGcXzEuCEVgkZmuyYSgcVK05nnj5+m4Lbo86WkxPpbuLPMcgiWcCxfGWigVTxywaMSsERaWL5r6Kw8aSczdlXHrIBDvncxEuXP8koIB3hIjy5tPLc3WKc8SxZTmex1VBq66Jh4qET8mTpLqgHTwF1+yVxzUkIFXq9rIeZg+wLP3QM9N4T3E2pf+vf0HHYimjOY0SZ1uRNblhij7beGWcAnrGHyXsAZSwlAHRuAibrDzY7BMg8XaiwL1RBqLrOQEjGmQMJnBsh1RTq7Zele0kdbERhVWnG8hSmdfl7IRhqojqnNRcC2HbUmyed8+JEtS/hCHQAyiaBpV6BI75o79D/9Dx/8LEPdiDNlwukeXOi1hdNeVzT298ALIzZzcvHs/2eRH2pL961chrqGeJfSE2iZIvHWJ8sqQOf9ItmQ4rFgDQLaMq1cg3px6dhQDflk9hD588MvVFNabPJvadJ8JPCssYwB8gq55wwfFmMKyX61Z72eIb9y/VjyK0TWS0JGNnmhUzMhDVEadLBGqEhQcJHp3hN+t/yF+wOo1W8UNMUxeZAVF4RSqTHpRvis90HB6QQ3R3ZEPOiQo1Z8Q5iDKfXjuH6Nutm/p2DJ0yUiCGiHNM=----ATTACHMENT:----OTA4NTg0MzE4ODU2OTMyMyA1MjQ1MTEyMjQyODk2MzM0IDE0NDY2ODAyMjA5NjQwOTI=