Browse Source

Add unit tests for InvalidPath Exception being thrown

tags/v8.1RC2
Joas Schilling 9 years ago
parent
commit
249e54e34a
1 changed files with 27 additions and 1 deletions
  1. 27
    1
      tests/lib/connector/sabre/directory.php

+ 27
- 1
tests/lib/connector/sabre/directory.php View File

@@ -140,7 +140,33 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {

// calling a second time just returns the cached values,
// does not call getDirectoryContents again
$nodes = $dir->getChildren();
$dir->getChildren();
}

/**
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
*/
public function testGetChildThrowStorageNotAvailableException() {
$this->view->expects($this->once())
->method('getFileInfo')
->willThrowException(new \OCP\Files\StorageNotAvailableException());

$dir = new \OC\Connector\Sabre\Directory($this->view, $this->info);
$dir->getChild('.');
}

/**
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath
*/
public function testGetChildThrowInvalidPath() {
$this->view->expects($this->once())
->method('verifyPath')
->willThrowException(new \OCP\Files\InvalidPathException());
$this->view->expects($this->never())
->method('getFileInfo');

$dir = new \OC\Connector\Sabre\Directory($this->view, $this->info);
$dir->getChild('.');
}

public function testGetQuotaInfo() {

Loading…
Cancel
Save