PartFileInRootUploadTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
  8. use OC\AllConfig;
  9. use OCP\IConfig;
  10. /**
  11. * Class PartFileInRootUploadTest
  12. *
  13. * @group DB
  14. *
  15. * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
  16. */
  17. class PartFileInRootUploadTest extends UploadTest {
  18. protected function setUp(): void {
  19. $config = \OC::$server->getConfig();
  20. $mockConfig = $this->getMockBuilder(IConfig::class)
  21. ->disableOriginalConstructor()
  22. ->getMock();
  23. $mockConfig->expects($this->any())
  24. ->method('getSystemValue')
  25. ->willReturnCallback(function ($key, $default) use ($config) {
  26. if ($key === 'part_file_in_storage') {
  27. return false;
  28. } else {
  29. return $config->getSystemValue($key, $default);
  30. }
  31. });
  32. $this->overwriteService(AllConfig::class, $mockConfig);
  33. parent::setUp();
  34. }
  35. protected function tearDown(): void {
  36. $this->restoreService('AllConfig');
  37. parent::tearDown();
  38. }
  39. }