LocalRootScannerTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Files\Cache;
  8. use OC\Files\Storage\LocalRootStorage;
  9. use Test\TestCase;
  10. /**
  11. * @group DB
  12. */
  13. class LocalRootScannerTest extends TestCase {
  14. /** @var LocalRootStorage */
  15. private $storage;
  16. protected function setUp(): void {
  17. parent::setUp();
  18. $folder = \OC::$server->getTempManager()->getTemporaryFolder();
  19. $this->storage = new LocalRootStorage(['datadir' => $folder]);
  20. }
  21. public function testDontScanUsers(): void {
  22. $this->storage->mkdir('foo');
  23. $this->storage->mkdir('foo/bar');
  24. $this->storage->getScanner()->scan('');
  25. $this->assertFalse($this->storage->getCache()->inCache('foo'));
  26. }
  27. public function testDoScanAppData(): void {
  28. $this->storage->mkdir('appdata_foo');
  29. $this->storage->mkdir('appdata_foo/bar');
  30. $this->storage->getScanner()->scan('');
  31. $this->assertTrue($this->storage->getCache()->inCache('appdata_foo'));
  32. $this->assertTrue($this->storage->getCache()->inCache('appdata_foo/bar'));
  33. }
  34. }