Merge pull request #1223 from nextcloud/core_command_phpunt_getmock

Fix depreccated getMock in Core/Command tests
This commit is contained in:
Joas Schilling 2016-09-01 10:07:52 +02:00 committed by GitHub
commit 45eefcfe8a
22 changed files with 167 additions and 90 deletions

View File

@ -23,10 +23,13 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\DeleteConfig; use OC\Core\Command\Config\App\DeleteConfig;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DeleteConfigTest extends TestCase { class DeleteConfigTest extends TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject */ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config; protected $config;
/** @var \PHPUnit_Framework_MockObject_MockObject */ /** @var \PHPUnit_Framework_MockObject_MockObject */
@ -40,14 +43,13 @@ class DeleteConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ $this->command = new DeleteConfig($this->config);
$this->command = new DeleteConfig($config);
} }

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\GetConfig; use OC\Core\Command\Config\App\GetConfig;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class GetConfigTest extends TestCase { class GetConfigTest extends TestCase {
@ -40,11 +43,11 @@ class GetConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new GetConfig($config); $this->command = new GetConfig($config);

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\SetConfig; use OC\Core\Command\Config\App\SetConfig;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class SetConfigTest extends TestCase { class SetConfigTest extends TestCase {
@ -40,11 +43,11 @@ class SetConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new SetConfig($config); $this->command = new SetConfig($config);

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config;
use OC\Core\Command\Config\Import; use OC\Core\Command\Config\Import;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class ImportTest extends TestCase { class ImportTest extends TestCase {
@ -40,11 +43,11 @@ class ImportTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new Import($config); $this->command = new Import($config);

View File

@ -23,7 +23,11 @@ namespace Tests\Core\Command\Config;
use OC\Core\Command\Config\ListConfigs; use OC\Core\Command\Config\ListConfigs;
use OC\SystemConfig;
use OCP\IAppConfig;
use OCP\IConfig; use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class ListConfigsTest extends TestCase { class ListConfigsTest extends TestCase {
@ -43,14 +47,14 @@ class ListConfigsTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$appConfig = $this->appConfig = $this->getMockBuilder('OCP\IAppConfig') $appConfig = $this->appConfig = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */ /** @var \OC\SystemConfig $systemConfig */
/** @var \OCP\IAppConfig $appConfig */ /** @var \OCP\IAppConfig $appConfig */

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\DeleteConfig; use OC\Core\Command\Config\System\DeleteConfig;
use OC\SystemConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DeleteConfigTest extends TestCase { class DeleteConfigTest extends TestCase {
@ -40,11 +43,11 @@ class DeleteConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */ /** @var \OC\SystemConfig $systemConfig */
$this->command = new DeleteConfig($systemConfig); $this->command = new DeleteConfig($systemConfig);

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\GetConfig; use OC\Core\Command\Config\System\GetConfig;
use OC\SystemConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class GetConfigTest extends TestCase { class GetConfigTest extends TestCase {
@ -40,11 +43,11 @@ class GetConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */ /** @var \OC\SystemConfig $systemConfig */
$this->command = new GetConfig($systemConfig); $this->command = new GetConfig($systemConfig);

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\SetConfig; use OC\Core\Command\Config\System\SetConfig;
use OC\SystemConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class SetConfigTest extends TestCase { class SetConfigTest extends TestCase {
@ -40,11 +43,11 @@ class SetConfigTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */ /** @var \OC\SystemConfig $systemConfig */
$this->command = new SetConfig($systemConfig); $this->command = new SetConfig($systemConfig);

View File

@ -28,6 +28,8 @@ use OC\Encryption\Util;
use OC\Files\View; use OC\Files\View;
use OCP\IConfig; use OCP\IConfig;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -65,16 +67,16 @@ class ChangeKeyStorageRootTest extends TestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->view = $this->getMock('\OC\Files\View'); $this->view = $this->getMockBuilder(View::class)->getMock();
$this->userManager = $this->getMock('\OCP\IUserManager'); $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->config = $this->getMock('\OCP\IConfig'); $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->util = $this->getMockBuilder('OC\Encryption\Util')->disableOriginalConstructor()->getMock(); $this->util = $this->getMockBuilder('OC\Encryption\Util')->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMock('Symfony\Component\Console\Helper\QuestionHelper'); $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)->getMock();
$this->inputInterface = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->inputInterface = $this->getMockBuilder(InputInterface::class)->getMock();
$this->outputInterface = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->outputInterface = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->userInterface = $this->getMock('\OCP\UserInterface'); $this->userInterface = $this->getMockBuilder(UserInterface::class)->getMock();
$outputFormatterInterface = $this->getMock('Symfony\Component\Console\Formatter\OutputFormatterInterface'); $outputFormatterInterface = $this->getMockBuilder(OutputFormatterInterface::class)->getMock();
$this->outputInterface->expects($this->any())->method('getFormatter') $this->outputInterface->expects($this->any())->method('getFormatter')
->willReturn($outputFormatterInterface); ->willReturn($outputFormatterInterface);

View File

@ -24,6 +24,12 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\DecryptAll; use OC\Core\Command\Encryption\DecryptAll;
use OCP\App\IAppManager;
use OCP\Encryption\IManager;
use OCP\IConfig;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DecryptAllTest extends TestCase { class DecryptAllTest extends TestCase {
@ -52,22 +58,22 @@ class DecryptAllTest extends TestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->config = $this->getMockBuilder('OCP\IConfig') $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager') $this->encryptionManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->appManager = $this->getMockBuilder('OCP\App\IAppManager') $this->appManager = $this->getMockBuilder(IAppManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->decryptAll = $this->getMockBuilder('OC\Encryption\DecryptAll') $this->decryptAll = $this->getMockBuilder(\OC\Encryption\DecryptAll::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->config->expects($this->any()) $this->config->expects($this->any())
->method('getSystemValue') ->method('getSystemValue')

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\Disable; use OC\Core\Command\Encryption\Disable;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DisableTest extends TestCase { class DisableTest extends TestCase {
@ -39,11 +42,11 @@ class DisableTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new Disable($config); $this->command = new Disable($config);

View File

@ -23,6 +23,10 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\Enable; use OC\Core\Command\Encryption\Enable;
use OCP\Encryption\IManager;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class EnableTest extends TestCase { class EnableTest extends TestCase {
@ -41,14 +45,14 @@ class EnableTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager') $manager = $this->manager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
/** @var \OCP\Encryption\IManager $manager */ /** @var \OCP\Encryption\IManager $manager */

View File

@ -24,6 +24,13 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\EncryptAll; use OC\Core\Command\Encryption\EncryptAll;
use OCP\App\IAppManager;
use OCP\Encryption\IEncryptionModule;
use OCP\Encryption\IManager;
use OCP\IConfig;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class EncryptAllTest extends TestCase { class EncryptAllTest extends TestCase {
@ -55,23 +62,23 @@ class EncryptAllTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->config = $this->getMockBuilder('OCP\IConfig') $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager') $this->encryptionManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->appManager = $this->getMockBuilder('OCP\App\IAppManager') $this->appManager = $this->getMockBuilder(IAppManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->encryptionModule = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule') $this->encryptionModule = $this->getMockBuilder(IEncryptionModule::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
} }

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\SetDefaultModule; use OC\Core\Command\Encryption\SetDefaultModule;
use OCP\Encryption\IManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class SetDefaultModuleTest extends TestCase { class SetDefaultModuleTest extends TestCase {
@ -39,11 +42,11 @@ class SetDefaultModuleTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager') $manager = $this->manager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\Encryption\IManager $manager */ /** @var \OCP\Encryption\IManager $manager */
$this->command = new SetDefaultModule($manager); $this->command = new SetDefaultModule($manager);

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log;
use OC\Core\Command\Log\File; use OC\Core\Command\Log\File;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class FileTest extends TestCase { class FileTest extends TestCase {
@ -39,11 +42,11 @@ class FileTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new File($config); $this->command = new File($config);
} }

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log;
use OC\Core\Command\Log\Manage; use OC\Core\Command\Log\Manage;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class ManageTest extends TestCase { class ManageTest extends TestCase {
@ -39,11 +42,11 @@ class ManageTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new Manage($config); $this->command = new Manage($config);
} }

View File

@ -24,6 +24,8 @@ namespace Tests\Core\Command\Maintenance;
use OC\Core\Command\Maintenance\DataFingerprint; use OC\Core\Command\Maintenance\DataFingerprint;
use OCP\AppFramework\Utility\ITimeFactory; use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig; use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DataFingerprintTest extends TestCase { class DataFingerprintTest extends TestCase {
@ -42,10 +44,10 @@ class DataFingerprintTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->config = $this->getMock('OCP\IConfig'); $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->timeFactory = $this->getMock('OCP\AppFramework\Utility\ITimeFactory'); $this->timeFactory = $this->getMockBuilder(ITimeFactory::class)->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new DataFingerprint($this->config, $this->timeFactory); $this->command = new DataFingerprint($this->config, $this->timeFactory);

View File

@ -22,6 +22,10 @@
namespace Tests\Core\Command\Maintenance\Mimetype; namespace Tests\Core\Command\Maintenance\Mimetype;
use OC\Core\Command\Maintenance\Mimetype\UpdateDB; use OC\Core\Command\Maintenance\Mimetype\UpdateDB;
use OC\Files\Type\Detection;
use OC\Files\Type\Loader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
use OCP\Files\IMimeTypeDetector; use OCP\Files\IMimeTypeDetector;
use OCP\Files\IMimeTypeLoader; use OCP\Files\IMimeTypeLoader;
@ -43,15 +47,15 @@ class UpdateDBTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->detector = $this->getMockBuilder('OC\Files\Type\Detection') $this->detector = $this->getMockBuilder(Detection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->loader = $this->getMockBuilder('OC\Files\Type\Loader') $this->loader = $this->getMockBuilder(Loader::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new UpdateDB($this->detector, $this->loader); $this->command = new UpdateDB($this->detector, $this->loader);
} }

View File

@ -23,6 +23,9 @@ namespace Tests\Core\Command\Maintenance;
use OC\Core\Command\Maintenance\SingleUser; use OC\Core\Command\Maintenance\SingleUser;
use OCP\IConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class SingleUserTest extends TestCase { class SingleUserTest extends TestCase {
@ -39,11 +42,11 @@ class SingleUserTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->config = $this->getMockBuilder('OCP\IConfig') $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */ /** @var \OCP\IConfig $config */
$this->command = new SingleUser($config); $this->command = new SingleUser($config);

View File

@ -23,6 +23,10 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\Delete; use OC\Core\Command\User\Delete;
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class DeleteTest extends TestCase { class DeleteTest extends TestCase {
@ -39,11 +43,11 @@ class DeleteTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager') $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IUserManager $userManager */ /** @var \OCP\IUserManager $userManager */
$this->command = new Delete($userManager); $this->command = new Delete($userManager);
@ -64,7 +68,7 @@ class DeleteTest extends TestCase {
* @param string $expectedString * @param string $expectedString
*/ */
public function testValidUser($deleteSuccess, $expectedString) { public function testValidUser($deleteSuccess, $expectedString) {
$user = $this->getMock('OCP\IUser'); $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once()) $user->expects($this->once())
->method('delete') ->method('delete')
->willReturn($deleteSuccess); ->willReturn($deleteSuccess);

View File

@ -23,6 +23,10 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\LastSeen; use OC\Core\Command\User\LastSeen;
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class LastSeenTest extends TestCase { class LastSeenTest extends TestCase {
@ -39,11 +43,11 @@ class LastSeenTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager') $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IUserManager $userManager */ /** @var \OCP\IUserManager $userManager */
$this->command = new LastSeen($userManager); $this->command = new LastSeen($userManager);
@ -63,7 +67,7 @@ class LastSeenTest extends TestCase {
* @param string $expectedString * @param string $expectedString
*/ */
public function testValidUser($lastSeen, $expectedString) { public function testValidUser($lastSeen, $expectedString) {
$user = $this->getMock('OCP\IUser'); $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once()) $user->expects($this->once())
->method('getLastLogin') ->method('getLastLogin')
->willReturn($lastSeen); ->willReturn($lastSeen);

View File

@ -23,6 +23,11 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\Setting; use OC\Core\Command\User\Setting;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase; use Test\TestCase;
class SettingTest extends TestCase { class SettingTest extends TestCase {
@ -40,19 +45,19 @@ class SettingTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->userManager = $this->getMockBuilder('OCP\IUserManager') $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->config = $this->getMockBuilder('OCP\IConfig') $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->connection = $this->getMockBuilder('OCP\IDBConnection') $this->connection = $this->getMockBuilder(IDBConnection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleInput = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface') $this->consoleInput = $this->getMockBuilder(InputInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->consoleOutput = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface') $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
} }