LoginFlowV2CredentialsTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @author Konrad Abicht <hi@inspirito.de>
  4. *
  5. * @copyright Copyright (c) 2021, Konrad Abicht <hi@inspirito.de>
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace Tests\Core\Data;
  22. use JsonSerializable;
  23. use OC\Core\Data\LoginFlowV2Credentials;
  24. use Test\TestCase;
  25. class LoginFlowV2CredentialsTest extends TestCase {
  26. /** @var \OC\Core\Data\LoginFlowV2Credentials */
  27. private $fixture;
  28. public function setUp(): void {
  29. parent::setUp();
  30. $this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass');
  31. }
  32. public function testImplementsJsonSerializable() {
  33. $this->assertTrue($this->fixture instanceof JsonSerializable);
  34. }
  35. /**
  36. * Test getter functions.
  37. */
  38. public function testGetter() {
  39. $this->assertEquals('server', $this->fixture->getServer());
  40. $this->assertEquals('login', $this->fixture->getLoginName());
  41. $this->assertEquals('pass', $this->fixture->getAppPassword());
  42. }
  43. public function testJsonSerialize() {
  44. $this->assertEquals(
  45. [
  46. 'server' => 'server',
  47. 'loginName' => 'login',
  48. 'appPassword' => 'pass',
  49. ],
  50. $this->fixture->jsonSerialize()
  51. );
  52. }
  53. }