diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-12-11 11:27:05 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-12-13 09:41:05 +0100 |
commit | b81b824da138281d904c775664c82f060ba4fbec (patch) | |
tree | 0194aea2aabe08a168bc32ccf964b94f31db6ae5 /tests/lib | |
parent | 642606754b133a36d7715b45b243155cbb006f95 (diff) | |
download | nextcloud-server-b81b824da138281d904c775664c82f060ba4fbec.tar.gz nextcloud-server-b81b824da138281d904c775664c82f060ba4fbec.zip |
Add typed events for the filesystem/scanner
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Files/EtagTest.php | 5 | ||||
-rw-r--r-- | tests/lib/Files/Utils/ScannerTest.php | 15 |
2 files changed, 11 insertions, 9 deletions
diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php index 554812253f3..d3b372fe137 100644 --- a/tests/lib/Files/EtagTest.php +++ b/tests/lib/Files/EtagTest.php @@ -9,6 +9,7 @@ namespace Test\Files; use OC\Files\Filesystem; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Share; use OCA\Files_Sharing\AppInfo\Application; @@ -35,7 +36,7 @@ class EtagTest extends \Test\TestCase { \OC_Hook::clear('OC_Filesystem', 'setup'); // init files sharing new Application(); - + \OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); \OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file'); @@ -69,7 +70,7 @@ class EtagTest extends \Test\TestCase { $files = array('/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt'); $originalEtags = $this->getEtags($files); - $scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->backgroundScan('/'); $newEtags = $this->getEtags($files); diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index 4af252735f6..44422cd97d1 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -12,6 +12,7 @@ use OC\Files\Filesystem; use OC\Files\Mount\MountPoint; use OC\Files\Storage\Temporary; use OCA\Files_Sharing\SharedStorage; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IMountProvider; use OCP\Files\Storage\IStorageFactory; use OCP\IUser; @@ -71,7 +72,7 @@ class ScannerTest extends \Test\TestCase { $storage->file_put_contents('foo.txt', 'qwerty'); $storage->file_put_contents('folder/bar.txt', 'qwerty'); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->addMount($mount); $scanner->scan(''); @@ -93,7 +94,7 @@ class ScannerTest extends \Test\TestCase { $storage->file_put_contents('foo.txt', 'qwerty'); $storage->file_put_contents('folder/bar.txt', 'qwerty'); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->addMount($mount); $scanner->scan(''); @@ -131,7 +132,7 @@ class ScannerTest extends \Test\TestCase { $storage->file_put_contents('foo.txt', 'qwerty'); $storage->file_put_contents('folder/bar.txt', 'qwerty'); - $scanner = new \OC\Files\Utils\Scanner($uid, \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new \OC\Files\Utils\Scanner($uid, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger()); $this->assertFalse($cache->inCache('folder/bar.txt')); $scanner->scan('/' . $uid . '/files/foo'); @@ -163,7 +164,7 @@ class ScannerTest extends \Test\TestCase { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid path to scan'); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->scan($invalidPath); } @@ -177,7 +178,7 @@ class ScannerTest extends \Test\TestCase { $storage->file_put_contents('folder/bar.txt', 'qwerty'); $storage->touch('folder/bar.txt', time() - 200); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->addMount($mount); $scanner->scan(''); @@ -204,7 +205,7 @@ class ScannerTest extends \Test\TestCase { $sharedStorage->expects($this->never()) ->method('getScanner'); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->addMount($sharedMount); $scanner->scan(''); @@ -223,7 +224,7 @@ class ScannerTest extends \Test\TestCase { $storage->file_put_contents('folder/bar.txt', 'qwerty'); $storage->file_put_contents('folder/subfolder/foobar.txt', 'qwerty'); - $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); + $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger()); $scanner->addMount($mount); $scanner->scan('', $recusive = false); |