dropbox.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <icewind@owncloud.com>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. * @author Vincent Petry <pvince81@owncloud.com>
  9. *
  10. * @copyright Copyright (c) 2016, ownCloud, Inc.
  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 Test\Files\Storage;
  27. /**
  28. * Class Dropbox
  29. *
  30. * @group DB
  31. *
  32. * @package Test\Files\Storage
  33. */
  34. class Dropbox extends Storage {
  35. private $config;
  36. protected function setUp() {
  37. parent::setUp();
  38. $id = $this->getUniqueID();
  39. $this->config = include('files_external/tests/config.php');
  40. if ( ! is_array($this->config) or ! isset($this->config['dropbox']) or ! $this->config['dropbox']['run']) {
  41. $this->markTestSkipped('Dropbox backend not configured');
  42. }
  43. $this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
  44. $this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
  45. }
  46. protected function tearDown() {
  47. if ($this->instance) {
  48. $this->instance->unlink('/');
  49. }
  50. parent::tearDown();
  51. }
  52. public function directoryProvider() {
  53. // doesn't support leading/trailing spaces
  54. return array(array('folder'));
  55. }
  56. public function testDropboxTouchReturnValue() {
  57. $this->assertFalse($this->instance->file_exists('foo'));
  58. // true because succeeded
  59. $this->assertTrue($this->instance->touch('foo'));
  60. $this->assertTrue($this->instance->file_exists('foo'));
  61. // false because not supported
  62. $this->assertFalse($this->instance->touch('foo'));
  63. }
  64. }