summaryrefslogtreecommitdiffstats
path: root/tests/lib/connector/sabre/directory.php
blob: 8a1550ffa95b13d3d4ff170043bec2b4e3021492 (plain)
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
42
43
44
45
46
47
48
<?php

/**
 * Copyright (c) 2013 Thomas Müller <thomas.mueller@tmit.eu>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase {

	private function getRootDir() {
		$view = $this->getMock('OC\Files\View', array(), array(), '', false);
		$view->expects($this->once())
			->method('getRelativePath')
			->will($this->returnValue(''));

		$info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false);
		$info->expects($this->once())
			->method('getPath')
			->will($this->returnValue(''));

		return new OC_Connector_Sabre_Directory($view, $info);
	}

	/**
	 * @expectedException \Sabre\DAV\Exception\Forbidden
	 */
	public function testCreateSharedFileFails() {
		$dir = $this->getRootDir();
		$dir->createFile('Shared');
	}

	/**
	 * @expectedException \Sabre\DAV\Exception\Forbidden
	 */
	public function testCreateSharedFolderFails() {
		$dir = $this->getRootDir();
		$dir->createDirectory('Shared');
	}

	/**
	 * @expectedException \Sabre\DAV\Exception\Forbidden
	 */
	public function testDeleteSharedFolderFails() {
		$dir = $this->getRootDir();
		$dir->delete();
	}
}