Merge pull request #24246 from owncloud/local-invalid
error out if a local storage isn't setup correctly
This commit is contained in:
commit
ddbebe91f0
|
@ -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 .= '/';
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue