diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/federation | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) | |
download | nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.tar.gz nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.zip |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/federation')
10 files changed, 18 insertions, 15 deletions
diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php index b4e8365b502..c0d7c2f6b7d 100644 --- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php @@ -81,7 +81,7 @@ class GetSharedSecretTest extends TestCase { /** @var GetSharedSecret */ private $getSharedSecret; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->httpClientService = $this->createMock(IClientService::class); diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index d97919942af..3eed5b89f7f 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -73,7 +73,7 @@ class RequestSharedSecretTest extends TestCase { /** @var RequestSharedSecret */ private $requestSharedSecret; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->httpClientService = $this->createMock(IClientService::class); diff --git a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php index c625d960e5a..d862faeae1b 100644 --- a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php +++ b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php @@ -67,7 +67,7 @@ class OCSAuthAPIControllerTest extends TestCase { /** @var int simulated timestamp */ private $currentTime = 1234567; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/federation/tests/Controller/SettingsControllerTest.php b/apps/federation/tests/Controller/SettingsControllerTest.php index 9b283b50903..2aa2a454f66 100644 --- a/apps/federation/tests/Controller/SettingsControllerTest.php +++ b/apps/federation/tests/Controller/SettingsControllerTest.php @@ -45,7 +45,7 @@ class SettingsControllerTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | \OCA\Federation\TrustedServers */ private $trustedServers; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->request = $this->getMockBuilder(IRequest::class)->getMock(); @@ -84,12 +84,13 @@ class SettingsControllerTest extends TestCase { /** * @dataProvider checkServerFails - * @expectedException \OC\HintException * * @param bool $isTrustedServer * @param bool $isOwnCloud */ public function testAddServerFail($isTrustedServer, $isOwnCloud) { + $this->expectException(\OC\HintException::class); + $this->trustedServers ->expects($this->any()) ->method('isTrustedServer') @@ -132,12 +133,13 @@ class SettingsControllerTest extends TestCase { /** * @dataProvider checkServerFails - * @expectedException \OC\HintException * * @param bool $isTrustedServer * @param bool $isOwnCloud */ public function testCheckServerFail($isTrustedServer, $isOwnCloud) { + $this->expectException(\OC\HintException::class); + $this->trustedServers ->expects($this->any()) ->method('isTrustedServer') diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index 348f5b70308..8d1eaa0ebc3 100644 --- a/apps/federation/tests/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -49,7 +49,7 @@ class DbHandlerTest extends TestCase { /** @var string */ private $dbTable = 'trusted_servers'; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->connection = \OC::$server->getDatabaseConnection(); @@ -65,7 +65,7 @@ class DbHandlerTest extends TestCase { $this->assertEmpty($result, 'we need to start with a empty trusted_servers table'); } - public function tearDown(): void { + protected function tearDown(): void { parent::tearDown(); $query = $this->connection->getQueryBuilder()->delete($this->dbTable); $query->execute(); diff --git a/apps/federation/tests/HooksTest.php b/apps/federation/tests/HooksTest.php index ad6e0bf8a77..027db171990 100644 --- a/apps/federation/tests/HooksTest.php +++ b/apps/federation/tests/HooksTest.php @@ -36,7 +36,7 @@ class HooksTest extends TestCase { /** @var Hooks */ private $hooks; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers') diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php index 4423233b93e..1557fb08330 100644 --- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php +++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php @@ -48,7 +48,7 @@ class AddServerMiddlewareTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | SettingsController */ private $controller; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); diff --git a/apps/federation/tests/Settings/AdminTest.php b/apps/federation/tests/Settings/AdminTest.php index 0fc1f7c25ab..ed7c049cc44 100644 --- a/apps/federation/tests/Settings/AdminTest.php +++ b/apps/federation/tests/Settings/AdminTest.php @@ -34,7 +34,7 @@ class AdminTest extends TestCase { /** @var TrustedServers */ private $trustedServers; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->trustedServers = $this->getMockBuilder('\OCA\Federation\TrustedServers')->disableOriginalConstructor()->getMock(); $this->admin = new Admin( diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index e1c810bde97..09b567e9435 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -38,7 +38,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | DiscoveryService */ private $discoveryService; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->discoveryService = $this->getMockBuilder(DiscoveryService::class) diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 82e5654e63f..2b1f8174e09 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -76,7 +76,7 @@ class TrustedServersTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject|ITimeFactory */ private $timeFactory; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->dbHandler = $this->getMockBuilder(DbHandler::class) @@ -352,10 +352,11 @@ class TrustedServersTest extends TestCase { /** * @dataProvider dataTestCheckOwnCloudVersionTooLow - * @expectedException \OC\HintException - * @expectedExceptionMessage Remote server version is too low. 9.0 is required. */ public function testCheckOwnCloudVersionTooLow($status) { + $this->expectException(\OC\HintException::class); + $this->expectExceptionMessage('Remote server version is too low. 9.0 is required.'); + $this->invokePrivate($this->trustedServers, 'checkOwnCloudVersion', [$status]); } |