diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/backgroundjob/joblist.php | 13 | ||||
-rw-r--r-- | tests/lib/configtests.php | 2 | ||||
-rw-r--r-- | tests/lib/files/cache/homecache.php | 2 | ||||
-rw-r--r-- | tests/lib/files/etagtest.php | 2 | ||||
-rw-r--r-- | tests/lib/files/filesystem.php | 6 | ||||
-rw-r--r-- | tests/lib/files/storage/commontest.php | 2 | ||||
-rw-r--r-- | tests/lib/files/storage/home.php | 2 | ||||
-rw-r--r-- | tests/lib/files/storage/local.php | 2 | ||||
-rw-r--r-- | tests/lib/files/storage/wrapper/quota.php | 2 | ||||
-rw-r--r-- | tests/lib/files/storage/wrapper/wrapper.php | 2 | ||||
-rw-r--r-- | tests/lib/files/view.php | 2 | ||||
-rw-r--r-- | tests/lib/helper.php | 122 | ||||
-rw-r--r-- | tests/lib/installer.php | 6 | ||||
-rw-r--r-- | tests/lib/streamwrappers.php | 4 | ||||
-rw-r--r-- | tests/lib/utilcheckserver.php | 2 |
15 files changed, 23 insertions, 148 deletions
diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php index 73b3255c079..c0796d8253a 100644 --- a/tests/lib/backgroundjob/joblist.php +++ b/tests/lib/backgroundjob/joblist.php @@ -15,26 +15,21 @@ use Test\TestCase; * Class JobList * * @group DB - * * @package Test\BackgroundJob */ class JobList extends TestCase { - /** - * @var \OC\BackgroundJob\JobList - */ + /** @var \OC\BackgroundJob\JobList */ protected $instance; - /** - * @var \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject $config - */ + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; protected function setUp() { parent::setUp(); - $conn = \OC::$server->getDatabaseConnection(); + $connection = \OC::$server->getDatabaseConnection(); $this->config = $this->getMock('\OCP\IConfig'); - $this->instance = new \OC\BackgroundJob\JobList($conn, $this->config); + $this->instance = new \OC\BackgroundJob\JobList($connection, $this->config); } protected function getAllSorted() { diff --git a/tests/lib/configtests.php b/tests/lib/configtests.php index 0269ae542f4..c0251e693c6 100644 --- a/tests/lib/configtests.php +++ b/tests/lib/configtests.php @@ -23,7 +23,7 @@ class ConfigTests extends TestCase { protected function setUp() { parent::setUp(); - $this->randomTmpDir = \OC_Helper::tmpFolder(); + $this->randomTmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->configFile = $this->randomTmpDir.'testconfig.php'; file_put_contents($this->configFile, self::TESTCONTENT); $this->config = new \OC\Config($this->randomTmpDir, 'testconfig.php'); diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php index 3adb25fa9d4..e133d0afc55 100644 --- a/tests/lib/files/cache/homecache.php +++ b/tests/lib/files/cache/homecache.php @@ -69,7 +69,7 @@ class HomeCache extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->user = new DummyUser('foo', \OC_Helper::tmpFolder()); + $this->user = new DummyUser('foo', \OC::$server->getTempManager()->getTemporaryFolder()); $this->storage = new \OC\Files\Storage\Home(array('user' => $this->user)); $this->cache = $this->storage->getCache(); } diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php index c214a3d4da6..d8e44000f9c 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/files/etagtest.php @@ -39,7 +39,7 @@ class EtagTest extends \Test\TestCase { $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('datadirectory'); - $this->tmpDir = \OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $config->setSystemValue('datadirectory', $this->tmpDir); $this->userBackend = new \Test\Util\User\Dummy(); diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php index de8979affd1..db1f22f894a 100644 --- a/tests/lib/files/filesystem.php +++ b/tests/lib/files/filesystem.php @@ -72,7 +72,7 @@ class Filesystem extends \Test\TestCase { * @return array */ private function getStorageData() { - $dir = \OC_Helper::tmpFolder(); + $dir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->tmpDirs[] = $dir; return array('datadir' => $dir); } @@ -302,7 +302,7 @@ class Filesystem extends \Test\TestCase { \OC\Files\Filesystem::mkdir('/bar'); // \OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo'); - $tmpFile = \OC_Helper::tmpFile(); + $tmpFile = \OC::$server->getTempManager()->getTemporaryFile(); file_put_contents($tmpFile, 'foo'); $fh = fopen($tmpFile, 'r'); // \OC\Files\Filesystem::file_put_contents('/bar//foo', $fh); @@ -416,7 +416,7 @@ class Filesystem extends \Test\TestCase { $config = \OC::$server->getConfig(); $oldCachePath = $config->getSystemValue('cache_path', ''); // set cache path to temp dir - $cachePath = \OC_Helper::tmpFolder() . '/extcache'; + $cachePath = \OC::$server->getTempManager()->getTemporaryFolder() . '/extcache'; $config->setSystemValue('cache_path', $cachePath); \OC::$server->getUserManager()->createUser($userId, $userId); diff --git a/tests/lib/files/storage/commontest.php b/tests/lib/files/storage/commontest.php index bbe6f2a73e2..38faa9b0b21 100644 --- a/tests/lib/files/storage/commontest.php +++ b/tests/lib/files/storage/commontest.php @@ -37,7 +37,7 @@ class CommonTest extends Storage { protected function setUp() { parent::setUp(); - $this->tmpDir=\OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->instance=new \OC\Files\Storage\CommonTest(array('datadir'=>$this->tmpDir)); } diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php index a51912ca1b2..7e10f09d554 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/files/storage/home.php @@ -70,7 +70,7 @@ class Home extends Storage { protected function setUp() { parent::setUp(); - $this->tmpDir = \OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user)); diff --git a/tests/lib/files/storage/local.php b/tests/lib/files/storage/local.php index 36267dc6605..2583863b554 100644 --- a/tests/lib/files/storage/local.php +++ b/tests/lib/files/storage/local.php @@ -38,7 +38,7 @@ class Local extends Storage { protected function setUp() { parent::setUp(); - $this->tmpDir = \OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->instance = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); } diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php index b0a06b0d898..95bc2ff7a1a 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -27,7 +27,7 @@ class Quota extends \Test\Files\Storage\Storage { protected function setUp() { parent::setUp(); - $this->tmpDir = \OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000)); } diff --git a/tests/lib/files/storage/wrapper/wrapper.php b/tests/lib/files/storage/wrapper/wrapper.php index 486cd0495c1..a5a678cb9f7 100644 --- a/tests/lib/files/storage/wrapper/wrapper.php +++ b/tests/lib/files/storage/wrapper/wrapper.php @@ -17,7 +17,7 @@ class Wrapper extends \Test\Files\Storage\Storage { protected function setUp() { parent::setUp(); - $this->tmpDir = \OC_Helper::tmpFolder(); + $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(array('storage' => $storage)); } diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 1fc4b9ab684..3e88a5306f8 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -757,7 +757,7 @@ class View extends \Test\TestCase { * 228 is the max path length in windows */ $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; - $tmpdirLength = strlen(\OC_Helper::tmpFolder()); + $tmpdirLength = strlen(\OC::$server->getTempManager()->getTemporaryFolder()); if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] '); $depth = ((260 - $tmpdirLength) / 57); diff --git a/tests/lib/helper.php b/tests/lib/helper.php index 51f7342f456..dbc89b716d0 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -245,126 +245,6 @@ class Test_Helper extends \Test\TestCase { /** * @small - * test absolute URL construction - * @dataProvider provideDocRootURLs - */ - function testMakeAbsoluteURLDocRoot($url, $expectedResult) { - \OC::$WEBROOT = ''; - $result = \OC_Helper::makeURLAbsolute($url); - - $this->assertEquals($expectedResult, $result); - } - - /** - * @small - * test absolute URL construction - * @dataProvider provideSubDirURLs - */ - function testMakeAbsoluteURLSubDir($url, $expectedResult) { - \OC::$WEBROOT = '/owncloud'; - $result = \OC_Helper::makeURLAbsolute($url); - - $this->assertEquals($expectedResult, $result); - } - - public function provideDocRootURLs() { - return array( - array('index.php', 'http://localhost/index.php'), - array('/index.php', 'http://localhost/index.php'), - array('/apps/index.php', 'http://localhost/apps/index.php'), - array('apps/index.php', 'http://localhost/apps/index.php'), - ); - } - - public function provideSubDirURLs() { - return array( - array('index.php', 'http://localhost/owncloud/index.php'), - array('/index.php', 'http://localhost/owncloud/index.php'), - array('/apps/index.php', 'http://localhost/owncloud/apps/index.php'), - array('apps/index.php', 'http://localhost/owncloud/apps/index.php'), - ); - } - - /** - * @small - * test linkToAbsolute URL construction - * @dataProvider provideDocRootAppAbsoluteUrlParts - */ - public function testLinkToAbsoluteDocRoot($app, $file, $args, $expectedResult) { - \OC::$WEBROOT = ''; - $result = \OC_Helper::linkToAbsolute($app, $file, $args); - - $this->assertEquals($expectedResult, $result); - } - - /** - * @small - * test linkToAbsolute URL construction in sub directory - * @dataProvider provideSubDirAppAbsoluteUrlParts - */ - public function testLinkToAbsoluteSubDir($app, $file, $args, $expectedResult) { - \OC::$WEBROOT = '/owncloud'; - $result = \OC_Helper::linkToAbsolute($app, $file, $args); - - $this->assertEquals($expectedResult, $result); - } - - /** - * @return array - */ - public function provideDocRootAppAbsoluteUrlParts() { - return array( - array('files', 'ajax/list.php', array(), 'http://localhost/index.php/apps/files/ajax/list.php'), - array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), 'http://localhost/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'), - array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), 'http://localhost/index.php?trut=trat&dut=dat'), - ); - } - - /** - * @return array - */ - public function provideSubDirAppAbsoluteUrlParts() { - return array( - array('files', 'ajax/list.php', array(), 'http://localhost/owncloud/index.php/apps/files/ajax/list.php'), - array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), 'http://localhost/owncloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'), - array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), 'http://localhost/owncloud/index.php?trut=trat&dut=dat'), - ); - } - - /** - * @small - * test linkToRemoteBase URL construction - */ - public function testLinkToRemoteBase() { - \OC::$WEBROOT = ''; - $result = \OC_Helper::linkToRemoteBase('webdav'); - $this->assertEquals('/remote.php/webdav', $result); - - \OC::$WEBROOT = '/owncloud'; - $result = \OC_Helper::linkToRemoteBase('webdav'); - $this->assertEquals('/owncloud/remote.php/webdav', $result); - } - - /** - * @small - * test linkToRemote URL construction - */ - public function testLinkToRemote() { - \OC::$WEBROOT = ''; - $result = \OC_Helper::linkToRemote('webdav'); - $this->assertEquals('http://localhost/remote.php/webdav/', $result); - $result = \OC_Helper::linkToRemote('webdav', false); - $this->assertEquals('http://localhost/remote.php/webdav', $result); - - \OC::$WEBROOT = '/owncloud'; - $result = \OC_Helper::linkToRemote('webdav'); - $this->assertEquals('http://localhost/owncloud/remote.php/webdav/', $result); - $result = \OC_Helper::linkToRemote('webdav', false); - $this->assertEquals('http://localhost/owncloud/remote.php/webdav', $result); - } - - /** - * @small * test linkToPublic URL construction */ public function testLinkToPublic() { @@ -403,7 +283,7 @@ class Test_Helper extends \Test\TestCase { * Tests recursive folder deletion with rmdirr() */ public function testRecursiveFolderDeletion() { - $baseDir = \OC_Helper::tmpFolder() . '/'; + $baseDir = \OC::$server->getTempManager()->getTemporaryFolder() . '/'; mkdir($baseDir . 'a/b/c/d/e', 0777, true); mkdir($baseDir . 'a/b/c1/d/e', 0777, true); mkdir($baseDir . 'a/b/c2/d/e', 0777, true); diff --git a/tests/lib/installer.php b/tests/lib/installer.php index c3c2f8a275e..cfad4d7f0de 100644 --- a/tests/lib/installer.php +++ b/tests/lib/installer.php @@ -32,7 +32,7 @@ class Test_Installer extends \Test\TestCase { $pathOfTestApp .= '/../data/'; $pathOfTestApp .= 'testapp.zip'; - $tmp = OC_Helper::tmpFile('.zip'); + $tmp = \OC::$server->getTempManager()->getTemporaryFile('.zip'); OC_Helper::copyr($pathOfTestApp, $tmp); $data = array( @@ -51,7 +51,7 @@ class Test_Installer extends \Test\TestCase { $pathOfOldTestApp .= '/../data/'; $pathOfOldTestApp .= 'testapp.zip'; - $oldTmp = OC_Helper::tmpFile('.zip'); + $oldTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip'); OC_Helper::copyr($pathOfOldTestApp, $oldTmp); $oldData = array( @@ -63,7 +63,7 @@ class Test_Installer extends \Test\TestCase { $pathOfNewTestApp .= '/../data/'; $pathOfNewTestApp .= 'testapp2.zip'; - $newTmp = OC_Helper::tmpFile('.zip'); + $newTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip'); OC_Helper::copyr($pathOfNewTestApp, $newTmp); $newData = array( diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php index 9b097535280..7175683a60b 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/streamwrappers.php @@ -55,7 +55,7 @@ class Test_StreamWrappers extends \Test\TestCase { public function testCloseStream() { //ensure all basic stream stuff works $sourceFile = OC::$SERVERROOT . '/tests/data/lorem.txt'; - $tmpFile = OC_Helper::TmpFile('.txt'); + $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); $file = 'close://' . $tmpFile; $this->assertTrue(file_exists($file)); file_put_contents($file, file_get_contents($sourceFile)); @@ -65,7 +65,7 @@ class Test_StreamWrappers extends \Test\TestCase { $this->assertFalse(file_exists($file)); //test callback - $tmpFile = OC_Helper::TmpFile('.txt'); + $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); $file = 'close://' . $tmpFile; $actual = false; $callback = function($path) use (&$actual) { $actual = $path; }; diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php index a5ec529ff85..64757d0acd9 100644 --- a/tests/lib/utilcheckserver.php +++ b/tests/lib/utilcheckserver.php @@ -37,7 +37,7 @@ class Test_Util_CheckServer extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->datadir = \OC_Helper::tmpFolder(); + $this->datadir = \OC::$server->getTempManager()->getTemporaryFolder(); file_put_contents($this->datadir . '/.ocdata', ''); \OC::$server->getSession()->set('checkServer_succeeded', false); |