LoginFlowV2CredentialsTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-only
  5. */
  6. namespace Tests\Core\Data;
  7. use JsonSerializable;
  8. use OC\Core\Data\LoginFlowV2Credentials;
  9. use Test\TestCase;
  10. class LoginFlowV2CredentialsTest extends TestCase {
  11. /** @var \OC\Core\Data\LoginFlowV2Credentials */
  12. private $fixture;
  13. public function setUp(): void {
  14. parent::setUp();
  15. $this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass');
  16. }
  17. public function testImplementsJsonSerializable() {
  18. $this->assertTrue($this->fixture instanceof JsonSerializable);
  19. }
  20. /**
  21. * Test getter functions.
  22. */
  23. public function testGetter() {
  24. $this->assertEquals('server', $this->fixture->getServer());
  25. $this->assertEquals('login', $this->fixture->getLoginName());
  26. $this->assertEquals('pass', $this->fixture->getAppPassword());
  27. }
  28. public function testJsonSerialize() {
  29. $this->assertEquals(
  30. [
  31. 'server' => 'server',
  32. 'loginName' => 'login',
  33. 'appPassword' => 'pass',
  34. ],
  35. $this->fixture->jsonSerialize()
  36. );
  37. }
  38. }