Blame view

sources/apps/files_external/tests/smbfunctions.php 1.25 KB
31b7f2792   Kload   Upgrade to ownclo...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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'));
  	}
  }