1
0

CompleteLoginCommandTest.php 990 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. declare(strict_types=1);
  7. namespace Test\Authentication\Login;
  8. use OC\Authentication\Login\CompleteLoginCommand;
  9. use OC\User\Session;
  10. use PHPUnit\Framework\MockObject\MockObject;
  11. class CompleteLoginCommandTest extends ALoginCommandTest {
  12. /** @var Session|MockObject */
  13. private $session;
  14. protected function setUp(): void {
  15. parent::setUp();
  16. $this->session = $this->createMock(Session::class);
  17. $this->cmd = new CompleteLoginCommand(
  18. $this->session
  19. );
  20. }
  21. public function testProcess() {
  22. $data = $this->getLoggedInLoginData();
  23. $this->session->expects($this->once())
  24. ->method('completeLogin')
  25. ->with(
  26. $this->user,
  27. $this->equalTo(
  28. [
  29. 'loginName' => $this->username,
  30. 'password' => $this->password,
  31. ]
  32. )
  33. );
  34. $result = $this->cmd->process($data);
  35. $this->assertTrue($result->isSuccess());
  36. }
  37. }