OwncloudTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 McCorkell <robin@mccorkell.me.uk>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  11. * @author Vincent Petry <vincent@nextcloud.com>
  12. *
  13. * @license AGPL-3.0
  14. *
  15. * This code is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License, version 3,
  17. * as published by the Free Software Foundation.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License, version 3,
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>
  26. *
  27. */
  28. namespace OCA\Files_External\Tests\Storage;
  29. use OCA\Files_External\Lib\Storage\OwnCloud;
  30. /**
  31. * Class OwnCloudTest
  32. *
  33. * @group DB
  34. *
  35. * @package OCA\Files_External\Tests\Storage
  36. */
  37. class OwncloudTest extends \Test\Files\Storage\Storage {
  38. private $config;
  39. protected function setUp(): void {
  40. parent::setUp();
  41. $id = $this->getUniqueID();
  42. $this->config = include('files_external/tests/config.php');
  43. if (! is_array($this->config) or ! isset($this->config['owncloud']) or ! $this->config['owncloud']['run']) {
  44. $this->markTestSkipped('Nextcloud backend not configured');
  45. }
  46. $this->config['owncloud']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
  47. $this->instance = new OwnCloud($this->config['owncloud']);
  48. $this->instance->mkdir('/');
  49. }
  50. protected function tearDown(): void {
  51. if ($this->instance) {
  52. $this->instance->rmdir('/');
  53. }
  54. parent::tearDown();
  55. }
  56. }