UserRenamedEventTest added.
This commit is contained in:
parent
4229ea05b0
commit
25e4973a11
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Skobkin\PointToolsBundle\Event;
|
||||
|
||||
use Skobkin\Bundle\PointToolsBundle\Entity\User;
|
||||
use Skobkin\Bundle\PointToolsBundle\Entity\UserRenameEvent;
|
||||
use Skobkin\Bundle\PointToolsBundle\Event\UsersRenamedEvent;
|
||||
|
||||
class UserRenamedEventTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNameConstant()
|
||||
{
|
||||
$this->assertEquals('app.users.renamed', UsersRenamedEvent::NAME, 'Event name changed');
|
||||
}
|
||||
|
||||
public function testGetRenames()
|
||||
{
|
||||
$user = new User(99999, 'testuser', 'Test User 1');
|
||||
$renameRecords = [
|
||||
new UserRenameEvent($user, 'testuser_old1'),
|
||||
new UserRenameEvent($user, 'testuser_old2'),
|
||||
new UserRenameEvent($user, 'testuser_old3'),
|
||||
];
|
||||
|
||||
$renameEvent = new UsersRenamedEvent($renameRecords);
|
||||
|
||||
$this->assertCount(3, $renameEvent->getRenames(), 'Not exactly 3 renames returned');
|
||||
$this->assertEquals('testuser_old1', $renameEvent->getRenames()[0]->getOldLogin(), 'Invalid old login returned');
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue