Add unit tests

This commit is contained in:
Lukas Reschke 2015-07-27 11:18:41 +02:00
parent f74525c349
commit c20d4d1a0b
1 changed files with 28 additions and 0 deletions

View File

@ -189,4 +189,32 @@ class Scanner extends \Test\TestCase {
$newInfo = $cache->get('');
$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);
}
}