summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-08-29 17:42:20 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-08-30 23:34:38 +0100
commit5a1619d80d1d0c80cc668a31526474c39bba0619 (patch)
treee3f5390f46aa06f71b074d18866ef2d46fb9ee99 /tests
parenta0dfaf9be36d35192cb797489740ec1008258e64 (diff)
downloadnextcloud-server-5a1619d80d1d0c80cc668a31526474c39bba0619.tar.gz
nextcloud-server-5a1619d80d1d0c80cc668a31526474c39bba0619.zip
Unit test getting temp dir from config
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/tempmanager.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/lib/tempmanager.php b/tests/lib/tempmanager.php
index 04e14c335bd..8faf804a203 100644
--- a/tests/lib/tempmanager.php
+++ b/tests/lib/tempmanager.php
@@ -50,7 +50,10 @@ class TempManager extends \Test\TestCase {
$logger = new NullLogger();
}
if (!$config) {
- $config = \OC::$server->getConfig();
+ $config = $this->getMock('\OCP\IConfig');
+ $config->method('getSystemValue')
+ ->with('tempdirectory', null)
+ ->willReturn('/tmp');
}
$manager = new \OC\TempManager($logger, $config);
if ($this->baseDir) {
@@ -195,4 +198,19 @@ class TempManager extends \Test\TestCase {
$this->assertStringEndsNotWith('./Traversal\\../FileName', $tmpManager);
$this->assertStringEndsWith('.Traversal..FileName', $tmpManager);
}
+
+ public function testGetTempBaseDirFromConfig() {
+ $dir = $this->getManager()->getTemporaryFolder();
+
+ $config = $this->getMock('\OCP\IConfig');
+ $config->expects($this->once())
+ ->method('getSystemValue')
+ ->with('tempdirectory', null)
+ ->willReturn($dir);
+
+ $this->baseDir = null; // prevent override
+ $tmpManager = $this->getManager(null, $config);
+
+ $this->assertEquals($dir, $tmpManager->getTempBaseDir());
+ }
}