Merge pull request #24289 from owncloud/local-invalid-9

[9.0] error out if a local storage isn't setup correctly
This commit is contained in:
C. Montero Luque 2016-04-26 21:19:23 -04:00
commit 1c23fa5d16
2 changed files with 17 additions and 0 deletions

View File

@ -39,6 +39,9 @@ class Local extends \OC\Files\Storage\Common {
protected $datadir;
public function __construct($arguments) {
if (!isset($arguments['datadir']) || !is_string($arguments['datadir'])) {
throw new \InvalidArgumentException('No data directory set for local storage');
}
$this->datadir = $arguments['datadir'];
if (substr($this->datadir, -1) !== '/') {
$this->datadir .= '/';

View File

@ -70,5 +70,19 @@ class Local extends Storage {
$etag2 = $this->instance->getETag('test.txt');
$this->assertNotEquals($etag1, $etag2);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testInvalidArgumentsEmptyArray() {
new \OC\Files\Storage\Local([]);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testInvalidArgumentsNoArray() {
new \OC\Files\Storage\Local(null);
}
}