From 25e4973a1150f585167832dbd6af8d63d25a4242 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Mon, 9 Jan 2017 23:39:24 +0300 Subject: [PATCH] UserRenamedEventTest added. --- .../Event/UserRenamedEventTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/Skobkin/PointToolsBundle/Event/UserRenamedEventTest.php diff --git a/tests/Skobkin/PointToolsBundle/Event/UserRenamedEventTest.php b/tests/Skobkin/PointToolsBundle/Event/UserRenamedEventTest.php new file mode 100644 index 0000000..b64dd93 --- /dev/null +++ b/tests/Skobkin/PointToolsBundle/Event/UserRenamedEventTest.php @@ -0,0 +1,30 @@ +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'); + } +} \ No newline at end of file