diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-07-27 11:18:41 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-07-27 11:21:49 +0200 |
commit | c20d4d1a0bf2a57754c675218a458365df2742ff (patch) | |
tree | 7b5426ce6c22bcc571e5cd9c3f8c7c16998861fa | |
parent | f74525c349c501c750d35e43153c862cf56a0221 (diff) | |
download | nextcloud-server-c20d4d1a0bf2a57754c675218a458365df2742ff.tar.gz nextcloud-server-c20d4d1a0bf2a57754c675218a458365df2742ff.zip |
Add unit tests
-rw-r--r-- | tests/lib/files/utils/scanner.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php index ca64b1db72e..75cd75ee3f5 100644 --- a/tests/lib/files/utils/scanner.php +++ b/tests/lib/files/utils/scanner.php @@ -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); + } } |