Skip to content

Commit

Permalink
Username in UsernameNotFoundException message data
Browse files Browse the repository at this point in the history
  • Loading branch information
maryo authored and fabpot committed Jun 6, 2014
1 parent c2d4be1 commit 3dfaa19
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Expand Up @@ -69,4 +69,12 @@ public function unserialize($str)

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());
}
}

0 comments on commit 3dfaa19

Please sign in to comment.