namespace OCA\Settings\Tests\Controller;
+use bantu\IniGetWrapper\IniGetWrapper;
use OC;
use OC\DB\Connection;
use OC\IntegrityCheck\Checker;
private $memoryInfo;
/** @var SecureRandom|\PHPUnit\Framework\MockObject\MockObject */
private $secureRandom;
+ /** @var IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
+ private $iniGetWrapper;
/**
* Holds a list of directories created during tests.
->setMethods(['isMemoryLimitSufficient',])
->getMock();
$this->secureRandom = $this->getMockBuilder(SecureRandom::class)->getMock();
+ $this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)->getMock();
$this->checkSetupController = $this->getMockBuilder(CheckSetupController::class)
->setConstructorArgs([
'settings',
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods([
'isReadOnlyConfig',
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods(null)->getMock();
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods(null)->getMock();
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
- $this->secureRandom
+ $this->secureRandom,
+ $this->iniGetWrapper
);
$this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isMysqlUsedWithoutUTF8MB4'));
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
- $this->secureRandom
+ $this->secureRandom,
+ $this->iniGetWrapper
);
$this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed'));
namespace Test;
+use bantu\IniGetWrapper\IniGetWrapper;
use OC\Log;
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;
*/
protected function getManager($logger = null, $config = null) {
if (!$logger) {
- $logger = new NullLogger();
+ $logger = $this->createMock(LoggerInterface::class);
}
if (!$config) {
$config = $this->createMock(IConfig::class);
->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);
}
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())
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())
}
public function testBuildFileNameWithPostfix() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',
}
public function testBuildFileNameWithoutPostfix() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',
}
public function testBuildFileNameWithSuffixPathTraversal() {
- $logger = $this->createMock(NullLogger::class);
+ $logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
'buildFileNameWithSuffix',