diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-08-20 20:45:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 20:45:47 +0300 |
commit | 987f62117351a658dc8c0916e38cfb0b7ca60982 (patch) | |
tree | 71baa54377f3bc4daf0329f08fa568f3e51e16ea /tests/lib | |
parent | ed1f89ae1023cff43d50f0cf027337eed872a31e (diff) | |
parent | 590d46121097d8b7dcd6f722b95f9dc4bdee653e (diff) |
Merge pull request #22331 from nextcloud/bugfix/noid/dont-use-deprecated-inigetwrapper
Don't use deprecated getIniWrapper() anymore
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/LargeFileHelperGetFileSizeTest.php | 4 | ||||
-rw-r--r-- | tests/lib/TempManagerTest.php | 28 |
2 files changed, 13 insertions, 19 deletions
diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php index 3ad8f5b8806..e21ac4ee64b 100644 --- a/tests/lib/LargeFileHelperGetFileSizeTest.php +++ b/tests/lib/LargeFileHelperGetFileSizeTest.php @@ -8,6 +8,8 @@ namespace Test; +use bantu\IniGetWrapper\IniGetWrapper; + /** * Tests whether LargeFileHelper is able to determine file size at all. * Large files are not considered yet. @@ -43,7 +45,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase { 'The PHP curl extension is required for this test.' ); } - if (\OC::$server->getIniWrapper()->getString('open_basedir') !== '') { + if (\OC::$server->get(IniGetWrapper::class)->getString('open_basedir') !== '') { $this->markTestSkipped( 'The PHP curl extension does not work with the file:// protocol when open_basedir is enabled.' ); 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', |