getConfig(); $mockConfig = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $mockConfig->expects($this->any()) ->method('getSystemValue') ->willReturnCallback(function ($key, $default) use ($config) { if ($key === 'part_file_in_storage') { return false; } else { return $config->getSystemValue($key, $default); } }); $this->overwriteService(AllConfig::class, $mockConfig); parent::setUp(); } protected function tearDown(): void { $this->restoreService('AllConfig'); parent::tearDown(); } }