aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Abicht <hi@inspirito.de>2021-02-09 15:25:37 +0100
committerKonrad Abicht <hi@inspirito.de>2021-02-09 15:25:37 +0100
commitb38a619212f79708e0525eca8a9d7a97727913c5 (patch)
tree45c16688b91f6a3be8d9be7a1a8b4526bab58cfe
parent9eea1e56dc0c33c504fb0e98578e22115b6b4c79 (diff)
downloadnextcloud-server-b38a619212f79708e0525eca8a9d7a97727913c5.tar.gz
nextcloud-server-b38a619212f79708e0525eca8a9d7a97727913c5.zip
added tests for OC\Core\Data\LoginFlowV2Credentials
Signed-off-by: Konrad Abicht <hi@inspirito.de>
-rw-r--r--tests/Core/Data/LoginFlowV2CredentialsTest.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php
new file mode 100644
index 00000000000..4b43a993487
--- /dev/null
+++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php
@@ -0,0 +1,63 @@
+<?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 {
+
+ private function createInstance(string $server, string $loginName, string $appPassword) {
+ return new LoginFlowV2Credentials($server, $loginName, $appPassword);
+ }
+
+ public function testImplementsJsonSerializable() {
+ $fixture = $this->createInstance('server', 'login', 'pass');
+
+ $this->assertTrue($fixture instanceof JsonSerializable);
+ }
+
+ /**
+ * Test getter functions.
+ */
+ public function testGetter() {
+ $fixture = $this->createInstance('server', 'login', 'pass');
+
+ $this->assertEquals('server', $fixture->getServer());
+ $this->assertEquals('login', $fixture->getLoginName());
+ $this->assertEquals('pass', $fixture->getAppPassword());
+ }
+
+ public function testJsonSerialize() {
+ $fixture = $this->createInstance('server', 'login', 'pass');
+
+ $this->assertEquals(
+ [
+ 'server' => 'server',
+ 'loginName' => 'login',
+ 'appPassword' => 'pass',
+ ],
+ $fixture->jsonSerialize()
+ );
+ }
+}