diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-10 10:22:57 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-10 10:22:57 +0200 |
commit | bc217cdf874238e9414810d5cd009d2d496e9ac5 (patch) | |
tree | ecaeb9fec3977ccfac4352edb64187f9c45c08d0 /tests/lib/Accounts | |
parent | d25a96d9216d2d58b48c45dafed1bed39e5c3c13 (diff) | |
download | nextcloud-server-bc217cdf874238e9414810d5cd009d2d496e9ac5.tar.gz nextcloud-server-bc217cdf874238e9414810d5cd009d2d496e9ac5.zip |
Also send the new account data with the event
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Accounts')
-rw-r--r-- | tests/lib/Accounts/AccountsManagerTest.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index 60811140e72..c0e20164908 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -27,6 +27,7 @@ use OC\Accounts\AccountManager; use OC\Mail\Mailer; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; /** @@ -75,12 +76,11 @@ class AccountsManagerTest extends TestCase { /** * @dataProvider dataTrueFalse - * - * @param bool $userAlreadyExists */ public function testUpdateUser($newData, $oldData, $insertNew, $updateExisitng) { $accountManager = $this->getInstance(['getUser', 'insertNewUser', 'updateExistingUser']); - $user = $this->getMockBuilder('OCP\IUser')->getMock(); + /** @var IUser $user */ + $user = $this->createMock(IUser::class); $accountManager->expects($this->once())->method('getUser')->with($user)->willReturn($oldData); @@ -102,9 +102,12 @@ class AccountsManagerTest extends TestCase { } else { $this->eventDispatcher->expects($this->once())->method('dispatch') ->willReturnCallback( - function ($eventName, $event) use ($user) { + function ($eventName, $event) use ($user, $newData) { $this->assertSame('OC\AccountManager::userUpdated', $eventName); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); + $this->assertInstanceOf(GenericEvent::class, $event); + /** @var GenericEvent $event */ + $this->assertSame($user, $event->getSubject()); + $this->assertSame($newData, $event->getArguments()); } ); } |