summaryrefslogtreecommitdiffstats
path: root/apps/files_external/3rdparty/icewind/smb/tests/Server.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-26 18:46:07 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-02-16 13:52:11 +0100
commitd2255a1d304aa5e537e8aa097add2a51aa0e5d89 (patch)
tree79801d54149e6c8037e717a1d5d6ac43327eb6db /apps/files_external/3rdparty/icewind/smb/tests/Server.php
parent78febb2ee594bac5d483f7c8534ed5eb33c2c528 (diff)
downloadnextcloud-server-d2255a1d304aa5e537e8aa097add2a51aa0e5d89.tar.gz
nextcloud-server-d2255a1d304aa5e537e8aa097add2a51aa0e5d89.zip
New SMB storage backend
Diffstat (limited to 'apps/files_external/3rdparty/icewind/smb/tests/Server.php')
-rw-r--r--apps/files_external/3rdparty/icewind/smb/tests/Server.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/apps/files_external/3rdparty/icewind/smb/tests/Server.php b/apps/files_external/3rdparty/icewind/smb/tests/Server.php
new file mode 100644
index 00000000000..9f62886654f
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/tests/Server.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Licensed under the MIT license:
+ * http://opensource.org/licenses/MIT
+ */
+
+namespace Icewind\SMB\Test;
+
+class Server extends \PHPUnit_Framework_TestCase {
+ /**
+ * @var \Icewind\SMB\Server $server
+ */
+ private $server;
+
+ private $config;
+
+ public function setUp() {
+ $this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
+ $this->server = new \Icewind\SMB\Server($this->config->host, $this->config->user, $this->config->password);
+ }
+
+ public function testListShares() {
+ $shares = $this->server->listShares();
+ foreach ($shares as $share) {
+ if ($share->getName() === $this->config->share) {
+ return;
+ }
+ }
+ $this->fail('Share "' . $this->config->share . '" not found');
+ }
+
+ /**
+ * @expectedException \Icewind\SMB\Exception\AuthenticationException
+ */
+ public function testWrongUserName() {
+ $this->markTestSkipped('This fails for no reason on travis');
+ $server = new \Icewind\SMB\Server($this->config->host, uniqid(), uniqid());
+ $server->listShares();
+ }
+
+ /**
+ * @expectedException \Icewind\SMB\Exception\AuthenticationException
+ */
+ public function testWrongPassword() {
+ $server = new \Icewind\SMB\Server($this->config->host, $this->config->user, uniqid());
+ $server->listShares();
+ }
+
+ /**
+ * @expectedException \Icewind\SMB\Exception\InvalidHostException
+ */
+ public function testWrongHost() {
+ $server = new \Icewind\SMB\Server(uniqid(), $this->config->user, $this->config->password);
+ $server->listShares();
+ }
+}