aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-07-27 19:57:10 +0200
committerJoas Schilling <coding@schilljs.com>2023-07-28 14:11:19 +0200
commit68fc9b48c24bf810488c5910da2feadd10587e51 (patch)
treecf183d9afa8f2fa5a9342341f4cf21d51bc6ad50 /tests
parent9bf812ac6c29f7722ba6db876dbabbc1b065dce1 (diff)
downloadnextcloud-server-68fc9b48c24bf810488c5910da2feadd10587e51.tar.gz
nextcloud-server-68fc9b48c24bf810488c5910da2feadd10587e51.zip
feat!: Migrate AccountManager event to typed event
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Accounts/AccountManagerTest.php21
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());
}
);
}