diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-11-28 10:36:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-28 10:36:10 +0300 |
commit | 669302e570024c83140ff5c4f4b1489c5a1c66ed (patch) | |
tree | 010182798f5c83193554031753e063a8a0b35ca1 /apps/settings/tests | |
parent | 125be68311a319f2b839e5aa4ea29cd642cd1e00 (diff) | |
parent | e3e782b63df4f1d65c86cb3b204b4bdecf93a6cd (diff) |
Merge pull request #18064 from nextcloud/feature/php74
Add php7.4 support
Diffstat (limited to 'apps/settings/tests')
20 files changed, 30 insertions, 29 deletions
diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php index f5d25608d66..2b7e3839e80 100644 --- a/apps/settings/tests/Activity/SecurityFilterTest.php +++ b/apps/settings/tests/Activity/SecurityFilterTest.php @@ -39,7 +39,7 @@ class SecurityFilterTest extends TestCase { /** @var SecurityFilter */ private $filter; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->urlGenerator = $this->createMock(IURLGenerator::class); diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index 143312addc2..9b34015e946 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -46,7 +46,7 @@ class SecurityProviderTest extends TestCase { /** @var SecurityProvider */ private $provider; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->l10n = $this->createMock(IFactory::class); diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php index 39ca3e2b792..805aa147bec 100644 --- a/apps/settings/tests/Activity/SecuritySettingTest.php +++ b/apps/settings/tests/Activity/SecuritySettingTest.php @@ -33,7 +33,7 @@ class SecuritySettingTest extends TestCase { /** @var SecuritySetting */ private $setting; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->l10n = $this->createMock(IL10N::class); diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php index 49ba48f10d2..35ca7117900 100644 --- a/apps/settings/tests/AppInfo/ApplicationTest.php +++ b/apps/settings/tests/AppInfo/ApplicationTest.php @@ -54,7 +54,7 @@ class ApplicationTest extends TestCase { /** @var IAppContainer */ protected $container; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->app = new Application(); $this->container = $this->app->getContainer(); diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php index 2789fe00974..21dc877975d 100644 --- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php @@ -62,7 +62,7 @@ class AdminSettingsControllerTest extends TestCase { /** @var string */ private $adminUid = 'lololo'; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); @@ -87,7 +87,7 @@ class AdminSettingsControllerTest extends TestCase { \OC::$server->getGroupManager()->createGroup('admin')->addUser($user); } - public function tearDown() { + protected function tearDown(): void { \OC::$server->getUserManager()->get($this->adminUid)->delete(); parent::tearDown(); diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 9b09631226f..536c3eea52a 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -76,7 +76,7 @@ class AppSettingsControllerTest extends TestCase { /** @var ILogger|MockObject */ private $logger; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index ff698ffe225..435cd390f86 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -61,7 +61,7 @@ class AuthSettingsControllerTest extends TestCase { private $remoteWipe; private $uid = 'jane'; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/settings/tests/Controller/CertificateControllerTest.php b/apps/settings/tests/Controller/CertificateControllerTest.php index ed0e7775dc1..e5487f6892c 100644 --- a/apps/settings/tests/Controller/CertificateControllerTest.php +++ b/apps/settings/tests/Controller/CertificateControllerTest.php @@ -48,7 +48,7 @@ class CertificateControllerTest extends \Test\TestCase { /** @var ICertificateManager */ private $systemCertificateManager; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->getMockBuilder(IRequest::class)->getMock(); diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 4d6a4c21f00..ca0e9362de1 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -87,7 +87,7 @@ class CheckSetupControllerTest extends TestCase { */ private $dirsToRemove = []; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->getMockBuilder(IRequest::class) diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index 1607926219e..5015ca0a7a1 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -41,7 +41,7 @@ class MailSettingsControllerTest extends \Test\TestCase { /** @var MailSettingsController */ private $mailController; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->l = $this->createMock(IL10N::class); @@ -172,7 +172,7 @@ class MailSettingsControllerTest extends \Test\TestCase { ->method('createEMailTemplate') ->willReturn($emailTemplate); $response = $this->mailController->sendTestMail(); - $this->assertSame(Http::STATUS_OK, $response->getStatus(), $response->getData()); + $this->assertSame(Http::STATUS_OK, $response->getStatus()); } } diff --git a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php index 58b82bc0930..d77f2303a6c 100644 --- a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php +++ b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php @@ -41,7 +41,7 @@ class TwoFactorSettingsControllerTest extends TestCase { /** @var TwoFactorSettingsController */ private $controller; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 5ca45297c58..d5d067f3eeb 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -74,7 +74,7 @@ class UsersControllerTest extends \Test\TestCase { /** @var IEncryptionModule | \PHPUnit_Framework_MockObject_MockObject */ private $encryptionModule; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->userManager = $this->createMock(IUserManager::class); @@ -353,7 +353,6 @@ class UsersControllerTest extends \Test\TestCase { * @param bool $setDisplayNameResult * @param bool $canChangeEmail * - * @expectedException \OC\ForbiddenException */ public function testSaveUserSettingsException($data, $oldEmailAddress, @@ -361,6 +360,8 @@ class UsersControllerTest extends \Test\TestCase { $setDisplayNameResult, $canChangeEmail ) { + $this->expectException(\OC\ForbiddenException::class); + $controller = $this->getController(); $user = $this->createMock(IUser::class); diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index f99af1e2f91..e84c4322562 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -57,7 +57,7 @@ class NewUserMailHelperTest extends TestCase { /** @var \OCA\Settings\Mailer\NewUserMailHelper */ private $newUserMailHelper; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->defaults = $this->createMock(Defaults::class); diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php index 752184bf7c7..51914604a98 100644 --- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php +++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php @@ -35,7 +35,7 @@ class SubadminMiddlewareTest extends \Test\TestCase { /** @var IL10N */ private $l10n; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->reflector = $this->getMockBuilder(ControllerMethodReflector::class) ->disableOriginalConstructor()->getMock(); @@ -47,10 +47,10 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->subadminMiddleware = new SubadminMiddleware($this->reflector, false, $this->l10n); } - /** - * @expectedException \OC\AppFramework\Middleware\Security\Exceptions\NotAdminException - */ + public function testBeforeControllerAsUserWithExemption() { + $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\NotAdminException::class); + $this->reflector ->expects($this->once()) ->method('hasAnnotation') @@ -93,10 +93,10 @@ class SubadminMiddlewareTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new NotAdminException(''))); } - /** - * @expectedException \Exception - */ + public function testAfterRegularException() { + $this->expectException(\Exception::class); + $expectedResponse = new TemplateResponse('core', '403', array(), 'guest'); $expectedResponse->setStatus(403); $this->subadminMiddleware->afterException($this->controller, 'foo', new \Exception()); diff --git a/apps/settings/tests/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Personal/Security/AuthtokensTest.php index 8cb394101e2..e2e5d3e6234 100644 --- a/apps/settings/tests/Personal/Security/AuthtokensTest.php +++ b/apps/settings/tests/Personal/Security/AuthtokensTest.php @@ -52,7 +52,7 @@ class AuthtokensTest extends TestCase { /** @var Security\Authtokens */ private $section; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->authTokenProvider = $this->createMock(IAuthTokenProvider::class); diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php index 5e26454a6fa..011329e7b89 100644 --- a/apps/settings/tests/Settings/Admin/MailTest.php +++ b/apps/settings/tests/Settings/Admin/MailTest.php @@ -34,7 +34,7 @@ class MailTest extends TestCase { /** @var IConfig */ private $config; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->config = $this->getMockBuilder(IConfig::class)->getMock(); diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php index ea9222ab1a7..6ddc0d39822 100644 --- a/apps/settings/tests/Settings/Admin/SecurityTest.php +++ b/apps/settings/tests/Settings/Admin/SecurityTest.php @@ -44,7 +44,7 @@ class SecurityTest extends TestCase { /** @var IInitialStateService|MockObject */ private $initialState; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->manager = $this->getMockBuilder(Manager::class)->disableOriginalConstructor()->getMock(); $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); diff --git a/apps/settings/tests/Settings/Admin/ServerTest.php b/apps/settings/tests/Settings/Admin/ServerTest.php index bcb990b6b6b..727284fdca4 100644 --- a/apps/settings/tests/Settings/Admin/ServerTest.php +++ b/apps/settings/tests/Settings/Admin/ServerTest.php @@ -34,7 +34,7 @@ class ServerTest extends TestCase { /** @var IConfig */ private $config; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 91b2edf14b1..38f687b87ae 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -42,7 +42,7 @@ class SharingTest extends TestCase { /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */ private $shareManager; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); diff --git a/apps/settings/tests/Settings/Personal/SecurityTest.php b/apps/settings/tests/Settings/Personal/SecurityTest.php index a55469c21e5..ba51a9d7e32 100644 --- a/apps/settings/tests/Settings/Personal/SecurityTest.php +++ b/apps/settings/tests/Settings/Personal/SecurityTest.php @@ -58,7 +58,7 @@ class SecurityTest extends TestCase { /** @var Security */ private $section; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->initialStateService = $this->createMock(IInitialStateService::class); |