diff options
Diffstat (limited to 'apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php')
-rw-r--r-- | apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php index 083efa9d273..cfc35e7cb1c 100644 --- a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php +++ b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php @@ -12,30 +12,26 @@ use OCA\TwoFactorBackupCodes\Service\BackupCodeStorage; use OCP\IUser; use OCP\Notification\IManager; use OCP\Notification\INotification; +use OCP\Server; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; /** * @group DB */ class BackupCodeStorageTest extends TestCase { - - /** @var BackupCodeStorage */ - private $storage; - - /** @var string */ - private $testUID = 'test123456789'; - - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ - private $notificationManager; + private IManager&MockObject $notificationManager; + private string $testUID = 'test123456789'; + private BackupCodeStorage $storage; protected function setUp(): void { parent::setUp(); - $this->storage = \OC::$server->query(BackupCodeStorage::class); + $this->storage = Server::get(BackupCodeStorage::class); $this->notificationManager = $this->createMock(IManager::class); $this->notificationManager->method('createNotification') - ->willReturn(\OC::$server->query(IManager::class)->createNotification()); + ->willReturn(Server::get(IManager::class)->createNotification()); $this->overwriteService(IManager::class, $this->notificationManager); } @@ -48,10 +44,10 @@ class BackupCodeStorageTest extends TestCase { $this->notificationManager->expects($this->once()) ->method('markProcessed') ->with($this->callback(function (INotification $notification) { - return $notification->getUser() === $this->testUID && - $notification->getObjectType() === 'create' && - $notification->getObjectId() === 'codes' && - $notification->getApp() === 'twofactor_backupcodes'; + return $notification->getUser() === $this->testUID + && $notification->getObjectType() === 'create' + && $notification->getObjectId() === 'codes' + && $notification->getApp() === 'twofactor_backupcodes'; })); // Create codes |