PartFileInRootUploadTest.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
  27. use OCP\IConfig;
  28. /**
  29. * Class PartFileInRootUploadTest
  30. *
  31. * @group DB
  32. *
  33. * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
  34. */
  35. class PartFileInRootUploadTest extends UploadTest {
  36. protected function setUp(): void {
  37. $config = \OC::$server->getConfig();
  38. $mockConfig = $this->getMockBuilder(IConfig::class)
  39. ->disableOriginalConstructor()
  40. ->getMock();
  41. $mockConfig->expects($this->any())
  42. ->method('getSystemValue')
  43. ->willReturnCallback(function ($key, $default) use ($config) {
  44. if ($key === 'part_file_in_storage') {
  45. return false;
  46. } else {
  47. return $config->getSystemValue($key, $default);
  48. }
  49. });
  50. $this->overwriteService('AllConfig', $mockConfig);
  51. parent::setUp();
  52. }
  53. protected function tearDown(): void {
  54. $this->restoreService('AllConfig');
  55. parent::tearDown();
  56. }
  57. }