Add unit tests
This commit is contained in:
parent
f74525c349
commit
c20d4d1a0b
|
@ -189,4 +189,32 @@ class Scanner extends \Test\TestCase {
|
||||||
$newInfo = $cache->get('');
|
$newInfo = $cache->get('');
|
||||||
$this->assertNotEquals($oldInfo['etag'], $newInfo['etag']);
|
$this->assertNotEquals($oldInfo['etag'], $newInfo['etag']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function invalidPathProvider() {
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'../',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'..\\',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'../..\\../',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider invalidPathProvider
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
* @expectedExceptionMessage Invalid path to scan
|
||||||
|
* @param string $invalidPath
|
||||||
|
*/
|
||||||
|
public function testInvalidPathScanning($invalidPath) {
|
||||||
|
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection());
|
||||||
|
$scanner->scan($invalidPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue