Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
commit3a7cf40aaa678bea1df143d2982d603b7a334eec (patch)
tree63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/settings/tests
parent0568b012672d650c6b5a49e72c4028dde5463c60 (diff)
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/settings/tests')
-rw-r--r--apps/settings/tests/Controller/AdminSettingsControllerTest.php4
-rw-r--r--apps/settings/tests/Controller/AppSettingsControllerTest.php2
-rw-r--r--apps/settings/tests/Controller/CertificateControllerTest.php2
-rw-r--r--apps/settings/tests/Controller/CheckSetupControllerTest.php2
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php3
-rw-r--r--apps/settings/tests/Mailer/NewUserMailHelperTest.php2
-rw-r--r--apps/settings/tests/Middleware/SubadminMiddlewareTest.php12
-rw-r--r--apps/settings/tests/Personal/Security/AuthtokensTest.php2
-rw-r--r--apps/settings/tests/Settings/Admin/MailTest.php2
-rw-r--r--apps/settings/tests/Settings/Admin/SecurityTest.php2
-rw-r--r--apps/settings/tests/Settings/Admin/ServerTest.php2
-rw-r--r--apps/settings/tests/Settings/Admin/SharingTest.php2
-rw-r--r--apps/settings/tests/Settings/Personal/SecurityTest.php2
13 files changed, 20 insertions, 19 deletions
diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php
index d3591c6d67a..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(): void {
+ 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(): void {
+ 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 508a39642a5..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(): void {
+ 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 270e986e307..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(): void {
+ 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 b038cf2af34..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(): void {
+ protected function setUp(): void {
parent::setUp();
$this->request = $this->getMockBuilder(IRequest::class)
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index eb5790a0401..d5d067f3eeb 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -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 77d606a9535..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(): void {
+ 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 e2434c01b02..51914604a98 100644
--- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
+++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
@@ -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 d0af05df913..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(): void {
+ 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 1b47dc874c1..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(): void {
+ 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 778690de1c8..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(): void {
+ 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 57c984fdb12..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(): void {
+ 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 37046d9d319..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(): void {
+ 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 671fcd6f9b4..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(): void {
+ protected function setUp(): void {
parent::setUp();
$this->initialStateService = $this->createMock(IInitialStateService::class);