PlaintextPasswordHasher example

namespace Symfony\Component\PasswordHasher\Tests\Hasher;

use PHPUnit\Framework\TestCase;
use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException;
use Symfony\Component\PasswordHasher\Hasher\PlaintextPasswordHasher;

class PlaintextPasswordHasherTest extends TestCase
{
    public function testVerify()
    {
        $hasher = new PlaintextPasswordHasher();

        $this->assertTrue($hasher->verify('foo', 'foo', ''));
        $this->assertFalse($hasher->verify('bar', 'foo', ''));
        $this->assertFalse($hasher->verify('FOO', 'foo', ''));

        $hasher = new PlaintextPasswordHasher(true);

        $this->assertTrue($hasher->verify('foo', 'foo', ''));
        $this->assertFalse($hasher->verify('bar', 'foo', ''));
        $this->assertTrue($hasher->verify('FOO', 'foo', ''));
    }

    
Home | Imprint | This part of the site doesn't use cookies.