Merge pull request #25548 from k00ni/pr/add-tests-for-LoginFlowV2Credentials

Added tests for OC\Core\Data\LoginFlowV2Credentials
This commit is contained in:
Christoph Wurst 2021-02-09 21:37:37 +01:00 committed by GitHub
commit e4ca0c9fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,61 @@
<?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 {
/** @var \OC\Core\Data\LoginFlowV2Credentials */
private $fixture;
public function setUp(): void {
parent::setUp();
$this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass');
}
public function testImplementsJsonSerializable() {
$this->assertTrue($this->fixture instanceof JsonSerializable);
}
/**
* Test getter functions.
*/
public function testGetter() {
$this->assertEquals('server', $this->fixture->getServer());
$this->assertEquals('login', $this->fixture->getLoginName());
$this->assertEquals('pass', $this->fixture->getAppPassword());
}
public function testJsonSerialize() {
$this->assertEquals(
[
'server' => 'server',
'loginName' => 'login',
'appPassword' => 'pass',
],
$this->fixture->jsonSerialize()
);
}
}