1
0

CheckBackupCodeTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\TwoFactorBackupCodes\Tests\Unit\Migration;
  8. use OCA\TwoFactorBackupCodes\Migration\CheckBackupCodes;
  9. use OCP\BackgroundJob\IJobList;
  10. use OCP\Migration\IOutput;
  11. use Test\TestCase;
  12. class CheckBackupCodeTest extends TestCase {
  13. /** @var IJobList|\PHPunit\Framework\MockObject\MockObject */
  14. private $jobList;
  15. /** @var CheckBackupCodes */
  16. private $checkBackupsCodes;
  17. protected function setUp(): void {
  18. parent::setUp();
  19. $this->jobList = $this->createMock(IJobList::class);
  20. $this->checkBackupsCodes = new CheckBackupCodes($this->jobList);
  21. }
  22. public function testGetName() {
  23. $this->assertSame('Add background job to check for backup codes', $this->checkBackupsCodes->getName());
  24. }
  25. public function testRun() {
  26. $this->jobList->expects($this->once())
  27. ->method('add')
  28. ->with(
  29. $this->equalTo(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class)
  30. );
  31. $this->checkBackupsCodes->run($this->createMock(IOutput::class));
  32. }
  33. }