2021-02-09 17:25:37 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Konrad Abicht <hi@inspirito.de>
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2021, Konrad Abicht <hi@inspirito.de>
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Tests\Core\Data;
|
|
|
|
|
|
|
|
use JsonSerializable;
|
|
|
|
use OC\Core\Data\LoginFlowV2Credentials;
|
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
class LoginFlowV2CredentialsTest extends TestCase {
|
2021-02-09 17:48:37 +03:00
|
|
|
/** @var \OC\Core\Data\LoginFlowV2Credentials */
|
|
|
|
private $fixture;
|
|
|
|
|
|
|
|
public function setUp(): void {
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass');
|
2021-02-09 17:25:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testImplementsJsonSerializable() {
|
2021-02-09 17:48:37 +03:00
|
|
|
$this->assertTrue($this->fixture instanceof JsonSerializable);
|
2021-02-09 17:25:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getter functions.
|
|
|
|
*/
|
|
|
|
public function testGetter() {
|
2021-02-09 17:48:37 +03:00
|
|
|
$this->assertEquals('server', $this->fixture->getServer());
|
|
|
|
$this->assertEquals('login', $this->fixture->getLoginName());
|
|
|
|
$this->assertEquals('pass', $this->fixture->getAppPassword());
|
2021-02-09 17:25:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testJsonSerialize() {
|
|
|
|
$this->assertEquals(
|
|
|
|
[
|
|
|
|
'server' => 'server',
|
|
|
|
'loginName' => 'login',
|
|
|
|
'appPassword' => 'pass',
|
|
|
|
],
|
2021-02-09 17:48:37 +03:00
|
|
|
$this->fixture->jsonSerialize()
|
2021-02-09 17:25:37 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|