dropbox.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Files\Storage;
  9. class Dropbox extends Storage {
  10. private $config;
  11. public function setUp() {
  12. $id = uniqid();
  13. $this->config = include('files_external/tests/config.php');
  14. if ( ! is_array($this->config) or ! isset($this->config['dropbox']) or ! $this->config['dropbox']['run']) {
  15. $this->markTestSkipped('Dropbox backend not configured');
  16. }
  17. $this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
  18. $this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
  19. }
  20. public function directoryProvider() {
  21. // doesn't support leading/trailing spaces
  22. return array(array('folder'));
  23. }
  24. public function testDropboxTouchReturnValue() {
  25. $this->assertFalse($this->instance->file_exists('foo'));
  26. // true because succeeded
  27. $this->assertTrue($this->instance->touch('foo'));
  28. $this->assertTrue($this->instance->file_exists('foo'));
  29. // false because not supported
  30. $this->assertFalse($this->instance->touch('foo'));
  31. }
  32. public function tearDown() {
  33. if ($this->instance) {
  34. $this->instance->unlink('/');
  35. }
  36. }
  37. }