Username in UsernameNotFoundException message data
This commit is contained in:
parent
c2d4be1d6b
commit
3dfaa19518
@ -69,4 +69,12 @@ class UsernameNotFoundException extends AuthenticationException
|
||||
|
||||
parent::unserialize($parentData);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMessageData()
|
||||
{
|
||||
return array('{{ username }}' => $this->username);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Tests\Core\Exception;
|
||||
|
||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||
|
||||
class UsernameNotFoundExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetMessageData()
|
||||
{
|
||||
$exception = new UsernameNotFoundException('Username could not be found.');
|
||||
$this->assertEquals(array('{{ username }}' => null), $exception->getMessageData());
|
||||
$exception->setUsername('username');
|
||||
$this->assertEquals(array('{{ username }}' => 'username'), $exception->getMessageData());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user