summaryrefslogtreecommitdiffstats
path: root/tests/lib/TempManagerTest.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-08-20 19:45:47 +0200
committerGitHub <noreply@github.com>2020-08-20 19:45:47 +0200
commit987f62117351a658dc8c0916e38cfb0b7ca60982 (patch)
tree71baa54377f3bc4daf0329f08fa568f3e51e16ea /tests/lib/TempManagerTest.php
parented1f89ae1023cff43d50f0cf027337eed872a31e (diff)
parent590d46121097d8b7dcd6f722b95f9dc4bdee653e (diff)
downloadnextcloud-server-987f62117351a658dc8c0916e38cfb0b7ca60982.tar.gz
nextcloud-server-987f62117351a658dc8c0916e38cfb0b7ca60982.zip
Merge pull request #22331 from nextcloud/bugfix/noid/dont-use-deprecated-inigetwrapper
Don't use deprecated getIniWrapper() anymore
Diffstat (limited to 'tests/lib/TempManagerTest.php')
-rw-r--r--tests/lib/TempManagerTest.php28
1 files changed, 10 insertions, 18 deletions
diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php
index a1b5e732b40..5df0e68d4fa 100644
--- a/tests/lib/TempManagerTest.php
+++ b/tests/lib/TempManagerTest.php
@@ -9,18 +9,9 @@
namespace Test;
-use OC\Log;
+use bantu\IniGetWrapper\IniGetWrapper;
use OCP\IConfig;
-
-class NullLogger extends Log {
- public function __construct($logger = null) {
- //disable original constructor
- }
-
- public function log(int $level, string $message, array $context = []) {
- //noop
- }
-}
+use Psr\Log\LoggerInterface;
class TempManagerTest extends \Test\TestCase {
protected $baseDir = null;
@@ -47,7 +38,7 @@ class TempManagerTest extends \Test\TestCase {
*/
protected function getManager($logger = null, $config = null) {
if (!$logger) {
- $logger = new NullLogger();
+ $logger = $this->createMock(LoggerInterface::class);
}
if (!$config) {
$config = $this->createMock(IConfig::class);
@@ -55,7 +46,8 @@ class TempManagerTest extends \Test\TestCase {
->with('tempdirectory', null)
->willReturn('/tmp');
}
- $manager = new \OC\TempManager($logger, $config);
+ $iniGetWrapper = $this->createMock(IniGetWrapper::class);
+ $manager = new \OC\TempManager($logger, $config, $iniGetWrapper);
if ($this->baseDir) {
$manager->overrideTempBaseDir($this->baseDir);
}
@@ -140,7 +132,7 @@ class TempManagerTest extends \Test\TestCase {
public function testLogCantCreateFile() {
$this->markTestSkipped('TODO: Disable because fails on drone');
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$manager = $this->getManager($logger);
chmod($this->baseDir, 0500);
$logger->expects($this->once())
@@ -152,7 +144,7 @@ class TempManagerTest extends \Test\TestCase {
public function testLogCantCreateFolder() {
$this->markTestSkipped('TODO: Disable because fails on drone');
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$manager = $this->getManager($logger);
chmod($this->baseDir, 0500);
$logger->expects($this->once())
@@ -162,7 +154,7 @@ class TempManagerTest extends \Test\TestCase {
}
public function testBuildFileNameWithPostfix() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',
@@ -173,7 +165,7 @@ class TempManagerTest extends \Test\TestCase {
}
public function testBuildFileNameWithoutPostfix() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',
@@ -184,7 +176,7 @@ class TempManagerTest extends \Test\TestCase {
}
public function testBuildFileNameWithSuffixPathTraversal() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',