You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smb.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 SMB 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['smb']) or !$this->config['smb']['run']) {
  15. $this->markTestSkipped('Samba backend not configured');
  16. }
  17. $this->config['smb']['root'] .= $id; //make sure we have an new empty folder to work in
  18. $this->instance = new \OC\Files\Storage\SMB($this->config['smb']);
  19. $this->instance->mkdir('/');
  20. }
  21. public function tearDown() {
  22. if ($this->instance) {
  23. \OCP\Files::rmdirr($this->instance->constructUrl(''));
  24. }
  25. }
  26. public function directoryProvider() {
  27. // doesn't support leading/trailing spaces
  28. return array(array('folder'));
  29. }
  30. public function testRenameWithSpaces() {
  31. $this->instance->mkdir('with spaces');
  32. $result = $this->instance->rename('with spaces', 'foo bar');
  33. $this->assertTrue($result);
  34. $this->assertTrue($this->instance->is_dir('foo bar'));
  35. }
  36. }