summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-14 16:52:00 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-19 15:05:11 +0100
commit8ab40f195984e76ec1fe8e89c8f0081f6bb7a418 (patch)
treeea9c02b008cc4e558e25965d76c98b93b9095286 /apps/files_external/tests
parenta7962faa5621c5a52e4fab3a94eab0b5b975e742 (diff)
downloadnextcloud-server-8ab40f195984e76ec1fe8e89c8f0081f6bb7a418.tar.gz
nextcloud-server-8ab40f195984e76ec1fe8e89c8f0081f6bb7a418.zip
Removing trailing dot in path that samba doesn't seem to like
Fixes #5778 Added unit test for getId() and constructUrl()
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/smbfunctions.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/files_external/tests/smbfunctions.php b/apps/files_external/tests/smbfunctions.php
new file mode 100644
index 00000000000..749906d0136
--- /dev/null
+++ b/apps/files_external/tests/smbfunctions.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Copyright (c) 2013 Vincent Petry <pvince81@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Storage;
+
+class SMBFunctions extends \PHPUnit_Framework_TestCase {
+
+ public function setUp() {
+ $id = uniqid();
+ // dummy config
+ $this->config = array(
+ 'run'=>false,
+ 'user'=>'test',
+ 'password'=>'testpassword',
+ 'host'=>'smbhost',
+ 'share'=>'/sharename',
+ 'root'=>'/rootdir/',
+ );
+
+ $this->instance = new \OC\Files\Storage\SMB($this->config);
+ }
+
+ public function tearDown() {
+ }
+
+ public function testGetId() {
+ $this->assertEquals('smb::test@smbhost//sharename//rootdir/', $this->instance->getId());
+ }
+
+ public function testConstructUrl() {
+ $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc'));
+ $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc/'));
+ $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2F", $this->instance->constructUrl('/abc/.'));
+ $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2Fdef", $this->instance->constructUrl('/abc/def'));
+ }
+}