summaryrefslogtreecommitdiffstats
path: root/apps/federation/tests/DAV
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-05-09 15:12:42 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2016-05-19 09:48:00 +0200
commitda332c134e4df3acf5fca077877d2baa881a6598 (patch)
treed1e7a847d522b7993faba1839d622c0a882e06ef /apps/federation/tests/DAV
parent0c727f175509ccfdec87dc69fd52af60cf2d6b94 (diff)
downloadnextcloud-server-da332c134e4df3acf5fca077877d2baa881a6598.tar.gz
nextcloud-server-da332c134e4df3acf5fca077877d2baa881a6598.zip
Move federation tests to PSR-4
Diffstat (limited to 'apps/federation/tests/DAV')
-rw-r--r--apps/federation/tests/DAV/FedAuthTest.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/apps/federation/tests/DAV/FedAuthTest.php b/apps/federation/tests/DAV/FedAuthTest.php
new file mode 100644
index 00000000000..b716084a45d
--- /dev/null
+++ b/apps/federation/tests/DAV/FedAuthTest.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @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 OCA\Federation\Tests\DAV;
+
+use OCA\Federation\DAV\FedAuth;
+use OCA\Federation\DbHandler;
+use Test\TestCase;
+
+class FedAuthTest extends TestCase {
+
+ /**
+ * @dataProvider providesUser
+ *
+ * @param array $expected
+ * @param string $user
+ * @param string $password
+ */
+ public function testFedAuth($expected, $user, $password) {
+ /** @var DbHandler | \PHPUnit_Framework_MockObject_MockObject $db */
+ $db = $this->getMockBuilder('OCA\Federation\DbHandler')->disableOriginalConstructor()->getMock();
+ $db->method('auth')->willReturn(true);
+ $auth = new FedAuth($db);
+ $result = $this->invokePrivate($auth, 'validateUserPass', [$user, $password]);
+ $this->assertEquals($expected, $result);
+ }
+
+ public function providesUser() {
+ return [
+ [true, 'system', '123456']
+ ];
+ }
+}