From 3a7cf40aaa678bea1df143d2982d603b7a334eec Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 27 Nov 2019 15:27:18 +0100 Subject: Mode to modern phpunit Signed-off-by: Roeland Jago Douma --- tests/lib/Encryption/ManagerTest.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests/lib/Encryption/ManagerTest.php') diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index 0919bda36b0..6e18cd296a3 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -35,7 +35,7 @@ class ManagerTest extends TestCase { /** @var ArrayCache|\PHPUnit_Framework_MockObject_MockObject */ private $arrayCache; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); $this->logger = $this->createMock(ILogger::class); @@ -81,10 +81,11 @@ class ManagerTest extends TestCase { /** * @depends testModuleRegistration - * @expectedException \OC\Encryption\Exceptions\ModuleAlreadyExistsException - * @expectedExceptionMessage Id "ID0" already used by encryption module "TestDummyModule0" */ public function testModuleReRegistration($manager) { + $this->expectException(\OC\Encryption\Exceptions\ModuleAlreadyExistsException::class); + $this->expectExceptionMessage('Id "ID0" already used by encryption module "TestDummyModule0"'); + $this->addNewEncryptionModule($manager, 0); } @@ -98,11 +99,11 @@ class ManagerTest extends TestCase { } - /** - * @expectedException \OC\Encryption\Exceptions\ModuleDoesNotExistsException - * @expectedExceptionMessage Module with ID: unknown does not exist. - */ + public function testGetEncryptionModuleUnknown() { + $this->expectException(\OC\Encryption\Exceptions\ModuleDoesNotExistsException::class); + $this->expectExceptionMessage('Module with ID: unknown does not exist.'); + $this->config->expects($this->any())->method('getAppValue')->willReturn(true); $this->addNewEncryptionModule($this->manager, 0); $this->assertCount(1, $this->manager->getEncryptionModules()); -- cgit v1.2.3