diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Accounts/AccountManagerTest.php | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php index 3a3405f18a0..d12dfbfacea 100644 --- a/tests/lib/Accounts/AccountManagerTest.php +++ b/tests/lib/Accounts/AccountManagerTest.php @@ -28,8 +28,10 @@ use OC\Accounts\Account; use OC\Accounts\AccountManager; use OCA\Settings\BackgroundJobs\VerifyUserData; use OCP\Accounts\IAccountManager; +use OCP\Accounts\UserUpdatedEvent; use OCP\BackgroundJob\IJobList; use OCP\Defaults; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IDBConnection; use OCP\IURLGenerator; @@ -40,8 +42,6 @@ use OCP\Security\ICrypto; use OCP\Security\VerificationToken\IVerificationToken; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; /** @@ -70,7 +70,7 @@ class AccountManagerTest extends TestCase { /** @var IConfig|MockObject */ private $config; - /** @var EventDispatcherInterface|MockObject */ + /** @var IEventDispatcher|MockObject */ private $eventDispatcher; /** @var IJobList|MockObject */ @@ -86,7 +86,7 @@ class AccountManagerTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $this->eventDispatcher = $this->createMock(IEventDispatcher::class); $this->connection = \OC::$server->get(IDBConnection::class); $this->config = $this->createMock(IConfig::class); $this->jobList = $this->createMock(IJobList::class); @@ -502,15 +502,14 @@ class AccountManagerTest extends TestCase { if (!$insertNew && !$updateExisting) { $accountManager->expects($this->never())->method('updateExistingUser'); $accountManager->expects($this->never())->method('insertNewUser'); - $this->eventDispatcher->expects($this->never())->method('dispatch'); + $this->eventDispatcher->expects($this->never())->method('dispatchTyped'); } else { - $this->eventDispatcher->expects($this->once())->method('dispatch') + $this->eventDispatcher->expects($this->once())->method('dispatchTyped') ->willReturnCallback( - function ($eventName, $event) use ($user, $newData) { - $this->assertSame('OC\AccountManager::userUpdated', $eventName); - $this->assertInstanceOf(GenericEvent::class, $event); - $this->assertSame($user, $event->getSubject()); - $this->assertSame($newData, $event->getArguments()); + function ($event) use ($user, $newData) { + $this->assertInstanceOf(UserUpdatedEvent::class, $event); + $this->assertSame($user, $event->getUser()); + $this->assertSame($newData, $event->getData()); } ); } |