diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 6dfa8ec6c7..f5df9b62b1 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -39,6 +39,7 @@ use OCP\Lock\LockedException; use OCP\Share\IManager; use OCP\Share; use Test\TestCase; +use OCP\Share\IShare; /** * Class ShareAPIControllerTest @@ -549,18 +550,18 @@ class ShareAPIControllerTest extends TestCase { ])); $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->getMockBuilder('OCP\Share\IShare')->getMock(); + $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('group2'); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); // null group - $share = $this->getMock('OCP\Share\IShare'); + $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); $share->method('getSharedWith')->willReturn('groupnull'); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); - $share = $this->getMockBuilder('OCP\Share\IShare')->getMock(); + $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); } diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index 3d0a9cb082..f3d43ff439 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -15,6 +15,8 @@ namespace Test; * * @package Test */ +use OCP\IDBConnection; + class AllConfigTest extends \Test\TestCase { /** @var \OCP\IDBConnection */ @@ -189,7 +191,7 @@ class AllConfigTest extends \Test\TestCase { ->method('fetchColumn') ->will($this->returnValue('valueSetUnchanged')); - $connectionMock = $this->getMock('\OCP\IDBConnection'); + $connectionMock = $this->createMock(IDBConnection::class); $connectionMock->expects($this->once()) ->method('executeQuery') ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '. diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index ac26d4cb52..6523407495 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -17,22 +17,22 @@ class ManagerTest extends TestCase { /** @var Manager */ private $manager; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10n; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var View|\PHPUnit_Framework_MockObject_MockObject */ private $view; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var Util|\PHPUnit_Framework_MockObject_MockObject */ private $util; - /** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Memcache\ArrayCache */ + /** @var ArrayCache|\PHPUnit_Framework_MockObject_MockObject */ private $arrayCache; public function setUp() { @@ -188,9 +188,9 @@ class ManagerTest extends TestCase { // * @expectedExceptionMessage Id "0" already used by encryption module "TestDummyModule0" // */ // public function testModuleRegistration() { -// $config = $this->getMock('\OCP\IConfig'); +// $config = $this->createMock(IConfig::class); // $config->expects($this->any())->method('getSystemValue')->willReturn(true); -// $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); +// $em = $this->createMock(IEncryptionModule::class); // $em->expects($this->any())->method('getId')->willReturn(0); // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); // $m = new Manager($config); @@ -200,9 +200,9 @@ class ManagerTest extends TestCase { // } // // public function testModuleUnRegistration() { -// $config = $this->getMock('\OCP\IConfig'); +// $config = $this->createMock(IConfig::class); // $config->expects($this->any())->method('getSystemValue')->willReturn(true); -// $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); +// $em = $this->createMock(IEncryptionModule::class); // $em->expects($this->any())->method('getId')->willReturn(0); // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); // $m = new Manager($config); @@ -217,9 +217,9 @@ class ManagerTest extends TestCase { // * @expectedExceptionMessage Module with ID: unknown does not exist. // */ // public function testGetEncryptionModuleUnknown() { -// $config = $this->getMock('\OCP\IConfig'); +// $config = $this->createMock(IConfig::class); // $config->expects($this->any())->method('getSystemValue')->willReturn(true); -// $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); +// $em = $this->createMock(IEncryptionModule::class); // $em->expects($this->any())->method('getId')->willReturn(0); // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); // $m = new Manager($config); @@ -229,9 +229,9 @@ class ManagerTest extends TestCase { // } // // public function testGetEncryptionModule() { -// $config = $this->getMock('\OCP\IConfig'); +// $config = $this->createMock(IConfig::class); // $config->expects($this->any())->method('getSystemValue')->willReturn(true); -// $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); +// $em = $this->createMock(IEncryptionModule::class); // $em->expects($this->any())->method('getId')->willReturn(0); // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); // $m = new Manager($config); diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php index 3f7a0ce064..1ec28de876 100644 --- a/tests/lib/RepairStepTest.php +++ b/tests/lib/RepairStepTest.php @@ -87,7 +87,7 @@ class RepairTest extends TestCase { } public function testRunRepairStepsWithException() { - $mock = $this->getMock('\Test\TestRepairStep'); + $mock = $this->createMock(TestRepairStep::class); $mock->expects($this->any()) ->method('run') ->will($this->throwException(new \Exception()));