smbfunctions.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Vincent Petry <pvince81@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 SMBFunctions extends \Test\TestCase {
  10. protected function setUp() {
  11. parent::setUp();
  12. // dummy config
  13. $this->config = array(
  14. 'run'=>false,
  15. 'user'=>'test',
  16. 'password'=>'testpassword',
  17. 'host'=>'smbhost',
  18. 'share'=>'/sharename',
  19. 'root'=>'/rootdir/',
  20. );
  21. $this->instance = new \OC\Files\Storage\SMB($this->config);
  22. }
  23. public function testGetId() {
  24. $this->assertEquals('smb::test@smbhost//sharename//rootdir/', $this->instance->getId());
  25. }
  26. public function testConstructUrl() {
  27. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc'));
  28. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc/'));
  29. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2F", $this->instance->constructUrl('/abc/.'));
  30. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2Fdef", $this->instance->constructUrl('/abc/def'));
  31. }
  32. }