diff options
Diffstat (limited to 'tests/lib/TempManagerTest.php')
-rw-r--r-- | tests/lib/TempManagerTest.php | 28 |
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', |