smbfunctions.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 \PHPUnit_Framework_TestCase {
  10. public function setUp() {
  11. $id = uniqid();
  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 tearDown() {
  24. }
  25. public function testGetId() {
  26. $this->assertEquals('smb::test@smbhost//sharename//rootdir/', $this->instance->getId());
  27. }
  28. public function testConstructUrl() {
  29. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc'));
  30. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc/'));
  31. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2F", $this->instance->constructUrl('/abc/.'));
  32. $this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2Fdef", $this->instance->constructUrl('/abc/def'));
  33. }
  34. }