diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-09-01 09:20:54 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-09-01 09:20:54 +0200 |
commit | 74fdaab870ba92db0d9ade65a428e9de04ee2e8d (patch) | |
tree | 0b148ef953f92e4aee3c4fca844569f39d8bb14a | |
parent | 4a5cd74fb29b19c975f893e0289b1b34bf5e8a62 (diff) | |
download | nextcloud-server-74fdaab870ba92db0d9ade65a428e9de04ee2e8d.tar.gz nextcloud-server-74fdaab870ba92db0d9ade65a428e9de04ee2e8d.zip |
Fix depreccated getMock in Core/Command tests
22 files changed, 167 insertions, 90 deletions
diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php index 7056e1b1ff9..f74fd73d697 100644 --- a/tests/Core/Command/Config/App/DeleteConfigTest.php +++ b/tests/Core/Command/Config/App/DeleteConfigTest.php @@ -23,10 +23,13 @@ namespace Tests\Core\Command\Config\App; 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; class DeleteConfigTest extends TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; /** @var \PHPUnit_Framework_MockObject_MockObject */ @@ -40,14 +43,13 @@ class DeleteConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); - /** @var \OCP\IConfig $config */ - $this->command = new DeleteConfig($config); + $this->command = new DeleteConfig($this->config); } diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index 1ceeb16ccf4..2fac1572e37 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App; 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; class GetConfigTest extends TestCase { @@ -40,11 +43,11 @@ class GetConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new GetConfig($config); diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php index 14d7b0cb7b5..f66390871de 100644 --- a/tests/Core/Command/Config/App/SetConfigTest.php +++ b/tests/Core/Command/Config/App/SetConfigTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App; 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; class SetConfigTest extends TestCase { @@ -40,11 +43,11 @@ class SetConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new SetConfig($config); diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php index f14880f8bf4..7afa47d3536 100644 --- a/tests/Core/Command/Config/ImportTest.php +++ b/tests/Core/Command/Config/ImportTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config; use OC\Core\Command\Config\Import; +use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class ImportTest extends TestCase { @@ -40,11 +43,11 @@ class ImportTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new Import($config); diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index bde6a1b0db3..0f170cee840 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -23,7 +23,11 @@ namespace Tests\Core\Command\Config; use OC\Core\Command\Config\ListConfigs; +use OC\SystemConfig; +use OCP\IAppConfig; use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class ListConfigsTest extends TestCase { @@ -43,14 +47,14 @@ class ListConfigsTest extends TestCase { protected function setUp() { parent::setUp(); - $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') + $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class) ->disableOriginalConstructor() ->getMock(); - $appConfig = $this->appConfig = $this->getMockBuilder('OCP\IAppConfig') + $appConfig = $this->appConfig = $this->getMockBuilder(IAppConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OC\SystemConfig $systemConfig */ /** @var \OCP\IAppConfig $appConfig */ diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php index 11bfb6ae7ad..5ac4c853df3 100644 --- a/tests/Core/Command/Config/System/DeleteConfigTest.php +++ b/tests/Core/Command/Config/System/DeleteConfigTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System; 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; class DeleteConfigTest extends TestCase { @@ -40,11 +43,11 @@ class DeleteConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') + $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OC\SystemConfig $systemConfig */ $this->command = new DeleteConfig($systemConfig); diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index ebbea634cde..943cc4cfa40 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System; 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; class GetConfigTest extends TestCase { @@ -40,11 +43,11 @@ class GetConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') + $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OC\SystemConfig $systemConfig */ $this->command = new GetConfig($systemConfig); diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index c0b664d7522..bb8d2c4b962 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System; 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; class SetConfigTest extends TestCase { @@ -40,11 +43,11 @@ class SetConfigTest extends TestCase { protected function setUp() { parent::setUp(); - $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig') + $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OC\SystemConfig $systemConfig */ $this->command = new SetConfig($systemConfig); diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 2a1f48983f1..57eb2137ac1 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -28,6 +28,8 @@ use OC\Encryption\Util; use OC\Files\View; use OCP\IConfig; use OCP\IUserManager; +use OCP\UserInterface; +use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -65,16 +67,16 @@ class ChangeKeyStorageRootTest extends TestCase { public function setUp() { parent::setUp(); - $this->view = $this->getMock('\OC\Files\View'); - $this->userManager = $this->getMock('\OCP\IUserManager'); - $this->config = $this->getMock('\OCP\IConfig'); + $this->view = $this->getMockBuilder(View::class)->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->util = $this->getMockBuilder('OC\Encryption\Util')->disableOriginalConstructor()->getMock(); - $this->questionHelper = $this->getMock('Symfony\Component\Console\Helper\QuestionHelper'); - $this->inputInterface = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->outputInterface = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); - $this->userInterface = $this->getMock('\OCP\UserInterface'); + $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)->getMock(); + $this->inputInterface = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->outputInterface = $this->getMockBuilder(OutputInterface::class)->getMock(); + $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') ->willReturn($outputFormatterInterface); diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 972ea03150c..8f674aa5b44 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -24,6 +24,12 @@ namespace Tests\Core\Command\Encryption; 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; class DecryptAllTest extends TestCase { @@ -52,22 +58,22 @@ class DecryptAllTest extends TestCase { public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager') + $this->encryptionManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $this->appManager = $this->getMockBuilder('OCP\App\IAppManager') + $this->appManager = $this->getMockBuilder(IAppManager::class) ->disableOriginalConstructor() ->getMock(); - $this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') + $this->questionHelper = $this->getMockBuilder(QuestionHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->decryptAll = $this->getMockBuilder('OC\Encryption\DecryptAll') + $this->decryptAll = $this->getMockBuilder(\OC\Encryption\DecryptAll::class) ->disableOriginalConstructor()->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); $this->config->expects($this->any()) ->method('getSystemValue') diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php index dfd06e2e26e..77a690fe264 100644 --- a/tests/Core/Command/Encryption/DisableTest.php +++ b/tests/Core/Command/Encryption/DisableTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption; use OC\Core\Command\Encryption\Disable; +use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class DisableTest extends TestCase { @@ -39,11 +42,11 @@ class DisableTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new Disable($config); diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index e2357464aa1..eb1b7842385 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -23,6 +23,10 @@ namespace Tests\Core\Command\Encryption; 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; class EnableTest extends TestCase { @@ -41,14 +45,14 @@ class EnableTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager') + $manager = $this->manager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ /** @var \OCP\Encryption\IManager $manager */ diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 128b4caa148..00895541782 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -24,6 +24,13 @@ namespace Tests\Core\Command\Encryption; 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; class EncryptAllTest extends TestCase { @@ -55,23 +62,23 @@ class EncryptAllTest extends TestCase { protected function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager') + $this->encryptionManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $this->appManager = $this->getMockBuilder('OCP\App\IAppManager') + $this->appManager = $this->getMockBuilder(IAppManager::class) ->disableOriginalConstructor() ->getMock(); - $this->encryptionModule = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule') + $this->encryptionModule = $this->getMockBuilder(IEncryptionModule::class) ->disableOriginalConstructor() ->getMock(); - $this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') + $this->questionHelper = $this->getMockBuilder(QuestionHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); } diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index 3230a57db07..3f04ba7e79d 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption; 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; class SetDefaultModuleTest extends TestCase { @@ -39,11 +42,11 @@ class SetDefaultModuleTest extends TestCase { protected function setUp() { parent::setUp(); - $manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager') + $manager = $this->manager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\Encryption\IManager $manager */ $this->command = new SetDefaultModule($manager); diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index f55f92901d6..4270684c9b6 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log; use OC\Core\Command\Log\File; +use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class FileTest extends TestCase { @@ -39,11 +42,11 @@ class FileTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); $this->command = new File($config); } diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index cf4506a64eb..4b026f14847 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log; use OC\Core\Command\Log\Manage; +use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class ManageTest extends TestCase { @@ -39,11 +42,11 @@ class ManageTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); $this->command = new Manage($config); } diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php index 4d661b5c027..90ffa50c012 100644 --- a/tests/Core/Command/Maintenance/DataFingerprintTest.php +++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php @@ -24,6 +24,8 @@ namespace Tests\Core\Command\Maintenance; use OC\Core\Command\Maintenance\DataFingerprint; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class DataFingerprintTest extends TestCase { @@ -42,10 +44,10 @@ class DataFingerprintTest extends TestCase { protected function setUp() { parent::setUp(); - $this->config = $this->getMock('OCP\IConfig'); - $this->timeFactory = $this->getMock('OCP\AppFramework\Utility\ITimeFactory'); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); + $this->timeFactory = $this->getMockBuilder(ITimeFactory::class)->getMock(); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new DataFingerprint($this->config, $this->timeFactory); diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index 217301102c5..8c023274da5 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -22,6 +22,10 @@ namespace Tests\Core\Command\Maintenance\Mimetype; 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 OCP\Files\IMimeTypeDetector; use OCP\Files\IMimeTypeLoader; @@ -43,15 +47,15 @@ class UpdateDBTest extends TestCase { protected function setUp() { parent::setUp(); - $this->detector = $this->getMockBuilder('OC\Files\Type\Detection') + $this->detector = $this->getMockBuilder(Detection::class) ->disableOriginalConstructor() ->getMock(); - $this->loader = $this->getMockBuilder('OC\Files\Type\Loader') + $this->loader = $this->getMockBuilder(Loader::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); $this->command = new UpdateDB($this->detector, $this->loader); } diff --git a/tests/Core/Command/Maintenance/SingleUserTest.php b/tests/Core/Command/Maintenance/SingleUserTest.php index 6629f39564f..13efebacb0a 100644 --- a/tests/Core/Command/Maintenance/SingleUserTest.php +++ b/tests/Core/Command/Maintenance/SingleUserTest.php @@ -23,6 +23,9 @@ namespace Tests\Core\Command\Maintenance; use OC\Core\Command\Maintenance\SingleUser; +use OCP\IConfig; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class SingleUserTest extends TestCase { @@ -39,11 +42,11 @@ class SingleUserTest extends TestCase { protected function setUp() { parent::setUp(); - $config = $this->config = $this->getMockBuilder('OCP\IConfig') + $config = $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IConfig $config */ $this->command = new SingleUser($config); diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php index bb813626d7a..1b94d37cfc4 100644 --- a/tests/Core/Command/User/DeleteTest.php +++ b/tests/Core/Command/User/DeleteTest.php @@ -23,6 +23,10 @@ namespace Tests\Core\Command\User; 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; class DeleteTest extends TestCase { @@ -39,11 +43,11 @@ class DeleteTest extends TestCase { protected function setUp() { parent::setUp(); - $userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager') + $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IUserManager $userManager */ $this->command = new Delete($userManager); @@ -64,7 +68,7 @@ class DeleteTest extends TestCase { * @param string $expectedString */ public function testValidUser($deleteSuccess, $expectedString) { - $user = $this->getMock('OCP\IUser'); + $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->once()) ->method('delete') ->willReturn($deleteSuccess); diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php index 84805f5c072..cceefb98810 100644 --- a/tests/Core/Command/User/LastSeenTest.php +++ b/tests/Core/Command/User/LastSeenTest.php @@ -23,6 +23,10 @@ namespace Tests\Core\Command\User; 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; class LastSeenTest extends TestCase { @@ -39,11 +43,11 @@ class LastSeenTest extends TestCase { protected function setUp() { parent::setUp(); - $userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager') + $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); /** @var \OCP\IUserManager $userManager */ $this->command = new LastSeen($userManager); @@ -63,7 +67,7 @@ class LastSeenTest extends TestCase { * @param string $expectedString */ public function testValidUser($lastSeen, $expectedString) { - $user = $this->getMock('OCP\IUser'); + $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->once()) ->method('getLastLogin') ->willReturn($lastSeen); diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 002e8dfef2f..56db670657a 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -23,6 +23,11 @@ namespace Tests\Core\Command\User; 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; class SettingTest extends TestCase { @@ -40,19 +45,19 @@ class SettingTest extends TestCase { protected function setUp() { parent::setUp(); - $this->userManager = $this->getMockBuilder('OCP\IUserManager') + $this->userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $this->config = $this->getMockBuilder('OCP\IConfig') + $this->config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->connection = $this->getMockBuilder('OCP\IDBConnection') + $this->connection = $this->getMockBuilder(IDBConnection::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleInput = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface') + $this->consoleInput = $this->getMockBuilder(InputInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->consoleOutput = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface') + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class) ->disableOriginalConstructor() ->getMock(); } |