aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Controller
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /tests/lib/AppFramework/Controller
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/AppFramework/Controller')
-rw-r--r--tests/lib/AppFramework/Controller/ApiControllerTest.php2
-rw-r--r--tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php8
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php14
-rw-r--r--tests/lib/AppFramework/Controller/OCSControllerTest.php10
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php4
5 files changed, 19 insertions, 19 deletions
diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php
index 6dea9938225..9dd980f975f 100644
--- a/tests/lib/AppFramework/Controller/ApiControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php
@@ -21,7 +21,7 @@ class ApiControllerTest extends \Test\TestCase {
/** @var ChildApiController */
protected $controller;
- public function testCors() {
+ public function testCors(): void {
$request = new Request(
['server' => ['HTTP_ORIGIN' => 'test']],
$this->createMock(IRequestId::class),
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index bec1b7a2a63..d6e0321023e 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -51,13 +51,13 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
])->getMock();
}
- public function testShowAuthenticate() {
+ public function testShowAuthenticate(): void {
$expects = new TemplateResponse('core', 'publicshareauth', [], 'guest');
$this->assertEquals($expects, $this->controller->showAuthenticate());
}
- public function testAuthenticateAuthenticated() {
+ public function testAuthenticateAuthenticated(): void {
$this->controller->method('isAuthenticated')
->willReturn(true);
@@ -74,7 +74,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$this->assertSame('myLink!', $result->getRedirectURL());
}
- public function testAuthenticateInvalidPassword() {
+ public function testAuthenticateInvalidPassword(): void {
$this->controller->setToken('token');
$this->controller->method('isPasswordProtected')
->willReturn(true);
@@ -94,7 +94,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $result);
}
- public function testAuthenticateValidPassword() {
+ public function testAuthenticateValidPassword(): void {
$this->controller->setToken('token');
$this->controller->method('isPasswordProtected')
->willReturn(true);
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index 7a6b3460947..7c466e3a5b7 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -79,21 +79,21 @@ class ControllerTest extends \Test\TestCase {
}
- public function testFormatResonseInvalidFormat() {
+ public function testFormatResonseInvalidFormat(): void {
$this->expectException(\DomainException::class);
$this->controller->buildResponse(null, 'test');
}
- public function testFormat() {
+ public function testFormat(): void {
$response = $this->controller->buildResponse(['hi'], 'json');
$this->assertEquals(['hi'], $response->getData());
}
- public function testFormatDataResponseJSON() {
+ public function testFormatDataResponseJSON(): void {
$expectedHeaders = [
'test' => 'something',
'Cache-Control' => 'no-cache, no-store, must-revalidate',
@@ -113,7 +113,7 @@ class ControllerTest extends \Test\TestCase {
}
- public function testCustomFormatter() {
+ public function testCustomFormatter(): void {
$response = $this->controller->custom('hi');
$response = $this->controller->buildResponse($response, 'json');
@@ -121,14 +121,14 @@ class ControllerTest extends \Test\TestCase {
}
- public function testDefaultResponderToJSON() {
+ public function testDefaultResponderToJSON(): void {
$responder = $this->controller->getResponderByHTTPHeader('*/*');
$this->assertEquals('json', $responder);
}
- public function testResponderAcceptHeaderParsed() {
+ public function testResponderAcceptHeaderParsed(): void {
$responder = $this->controller->getResponderByHTTPHeader(
'*/*, application/tom, application/json'
);
@@ -137,7 +137,7 @@ class ControllerTest extends \Test\TestCase {
}
- public function testResponderAcceptHeaderParsedUpperCase() {
+ public function testResponderAcceptHeaderParsedUpperCase(): void {
$responder = $this->controller->getResponderByHTTPHeader(
'*/*, apPlication/ToM, application/json'
);
diff --git a/tests/lib/AppFramework/Controller/OCSControllerTest.php b/tests/lib/AppFramework/Controller/OCSControllerTest.php
index ea86c01a364..027881074c9 100644
--- a/tests/lib/AppFramework/Controller/OCSControllerTest.php
+++ b/tests/lib/AppFramework/Controller/OCSControllerTest.php
@@ -20,7 +20,7 @@ class ChildOCSController extends OCSController {
class OCSControllerTest extends \Test\TestCase {
- public function testCors() {
+ public function testCors(): void {
$request = new Request(
[
'server' => [
@@ -45,7 +45,7 @@ class OCSControllerTest extends \Test\TestCase {
}
- public function testXML() {
+ public function testXML(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -74,7 +74,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testJSON() {
+ public function testJSON(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -91,7 +91,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testXMLV2() {
+ public function testXMLV2(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -118,7 +118,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testJSONV2() {
+ public function testJSONV2(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index be28843b03f..f8430d42ef1 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -50,7 +50,7 @@ class PublicShareControllerTest extends \Test\TestCase {
$this->session = $this->createMock(ISession::class);
}
- public function testGetToken() {
+ public function testGetToken(): void {
$controller = new TestController('app', $this->request, $this->session, 'hash', false);
$controller->setToken('test');
@@ -73,7 +73,7 @@ class PublicShareControllerTest extends \Test\TestCase {
/**
* @dataProvider dataIsAuthenticated
*/
- public function testIsAuthenticatedNotPasswordProtected(bool $protected, string $token1, string $token2, string $hash1, string $hash2, bool $expected) {
+ public function testIsAuthenticatedNotPasswordProtected(bool $protected, string $token1, string $token2, string $hash1, string $hash2, bool $expected): void {
$controller = new TestController('app', $this->request, $this->session, $hash2, $protected);
$this->session->method('get')