aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/tests
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 /apps/workflowengine/tests
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 'apps/workflowengine/tests')
-rw-r--r--apps/workflowengine/tests/Check/AbstractStringCheckTest.php8
-rw-r--r--apps/workflowengine/tests/Check/FileMimeTypeTest.php16
-rw-r--r--apps/workflowengine/tests/Check/RequestRemoteAddressTest.php8
-rw-r--r--apps/workflowengine/tests/Check/RequestTimeTest.php8
-rw-r--r--apps/workflowengine/tests/Check/RequestUserAgentTest.php2
-rw-r--r--apps/workflowengine/tests/ManagerTest.php26
6 files changed, 34 insertions, 34 deletions
diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
index e5182bea483..eb40b164176 100644
--- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
+++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
@@ -53,7 +53,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
* @param string $actualValue
* @param bool $expected
*/
- public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected) {
+ public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected): void {
$check = $this->getCheckMock();
/** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
@@ -74,7 +74,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
* @param string $operator
* @param string $value
*/
- public function testValidateCheck($operator, $value) {
+ public function testValidateCheck($operator, $value): void {
$check = $this->getCheckMock();
/** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */
@@ -99,7 +99,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
* @param $exceptionCode
* @param $exceptionMessage
*/
- public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) {
+ public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage): void {
$check = $this->getCheckMock();
try {
@@ -125,7 +125,7 @@ class AbstractStringCheckTest extends \Test\TestCase {
* @param array[] $matches
* @param bool $expected
*/
- public function testMatch($pattern, $subject, $matches, $expected) {
+ public function testMatch($pattern, $subject, $matches, $expected): void {
$check = $this->getCheckMock();
$this->invokePrivate($check, 'matches', [$matches]);
diff --git a/apps/workflowengine/tests/Check/FileMimeTypeTest.php b/apps/workflowengine/tests/Check/FileMimeTypeTest.php
index 60788036408..1fc5118c5c4 100644
--- a/apps/workflowengine/tests/Check/FileMimeTypeTest.php
+++ b/apps/workflowengine/tests/Check/FileMimeTypeTest.php
@@ -71,7 +71,7 @@ class FileMimeTypeTest extends TestCase {
});
}
- public function testUseCachedMimetype() {
+ public function testUseCachedMimetype(): void {
$storage = new Temporary([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'asd');
@@ -84,7 +84,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($check->executeCheck('is', 'text/plain'));
}
- public function testNonCachedNotExists() {
+ public function testNonCachedNotExists(): void {
$storage = new Temporary([]);
$check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
@@ -93,7 +93,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($check->executeCheck('is', 'text/plain-path-detected'));
}
- public function testNonCachedLocal() {
+ public function testNonCachedLocal(): void {
$storage = new Temporary([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'text-content');
@@ -104,7 +104,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($check->executeCheck('is', 'text/plain-content-detected'));
}
- public function testNonCachedNotLocal() {
+ public function testNonCachedNotLocal(): void {
$storage = new TemporaryNoLocal([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'text-content');
@@ -115,7 +115,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($check->executeCheck('is', 'text/plain-content-detected'));
}
- public function testFallback() {
+ public function testFallback(): void {
$storage = new Temporary([]);
$check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
@@ -124,7 +124,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($check->executeCheck('is', 'application/octet-stream'));
}
- public function testFromCacheCached() {
+ public function testFromCacheCached(): void {
$storage = new Temporary([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'text-content');
@@ -144,7 +144,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($newCheck->executeCheck('is', 'text/plain-content-detected'));
}
- public function testExistsCached() {
+ public function testExistsCached(): void {
$storage = new TemporaryNoLocal([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'text-content');
@@ -161,7 +161,7 @@ class FileMimeTypeTest extends TestCase {
$this->assertTrue($newCheck->executeCheck('is', 'text/plain-path-detected'));
}
- public function testNonExistsNotCached() {
+ public function testNonExistsNotCached(): void {
$storage = new TemporaryNoLocal([]);
$check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
index 7c46a33a477..438a59a8a48 100644
--- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
+++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
@@ -52,7 +52,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
* @param string $ip
* @param bool $expected
*/
- public function testExecuteCheckMatchesIPv4($value, $ip, $expected) {
+ public function testExecuteCheckMatchesIPv4($value, $ip, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
$this->request->expects($this->once())
@@ -68,7 +68,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
* @param string $ip
* @param bool $expected
*/
- public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected) {
+ public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
$this->request->expects($this->once())
@@ -96,7 +96,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
* @param string $ip
* @param bool $expected
*/
- public function testExecuteCheckMatchesIPv6($value, $ip, $expected) {
+ public function testExecuteCheckMatchesIPv6($value, $ip, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
$this->request->expects($this->once())
@@ -112,7 +112,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
* @param string $ip
* @param bool $expected
*/
- public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected) {
+ public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request);
$this->request->expects($this->once())
diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php
index 3c261fe2de3..34ea656f416 100644
--- a/apps/workflowengine/tests/Check/RequestTimeTest.php
+++ b/apps/workflowengine/tests/Check/RequestTimeTest.php
@@ -71,7 +71,7 @@ class RequestTimeTest extends \Test\TestCase {
* @param int $timestamp
* @param bool $expected
*/
- public function testExecuteCheckIn($value, $timestamp, $expected) {
+ public function testExecuteCheckIn($value, $timestamp, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
$this->timeFactory->expects($this->once())
@@ -87,7 +87,7 @@ class RequestTimeTest extends \Test\TestCase {
* @param int $timestamp
* @param bool $expected
*/
- public function testExecuteCheckNotIn($value, $timestamp, $expected) {
+ public function testExecuteCheckNotIn($value, $timestamp, $expected): void {
$check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
$this->timeFactory->expects($this->once())
@@ -110,7 +110,7 @@ class RequestTimeTest extends \Test\TestCase {
* @param string $operator
* @param string $value
*/
- public function testValidateCheck($operator, $value) {
+ public function testValidateCheck($operator, $value): void {
$check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
$check->validateCheck($operator, $value);
$this->addToAssertionCount(1);
@@ -135,7 +135,7 @@ class RequestTimeTest extends \Test\TestCase {
* @param int $exceptionCode
* @param string $exceptionMessage
*/
- public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) {
+ public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage): void {
$check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory);
try {
diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php
index f41f95c15ff..f74cf669cc7 100644
--- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php
+++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php
@@ -90,7 +90,7 @@ class RequestUserAgentTest extends TestCase {
* @param string $actualValue
* @param bool $expected
*/
- public function testExecuteCheck($operation, $checkValue, $actualValue, $expected) {
+ public function testExecuteCheck($operation, $checkValue, $actualValue, $expected): void {
$this->request->expects($this->once())
->method('getHeader')
->willReturn($actualValue);
diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php
index 4a547f5c8bf..334666af039 100644
--- a/apps/workflowengine/tests/ManagerTest.php
+++ b/apps/workflowengine/tests/ManagerTest.php
@@ -123,7 +123,7 @@ class ManagerTest extends TestCase {
}
}
- public function testChecks() {
+ public function testChecks(): void {
$check1 = $this->invokePrivate($this->manager, 'addCheck', ['Test', 'equal', 1]);
$check2 = $this->invokePrivate($this->manager, 'addCheck', ['Test', '!equal', 2]);
@@ -144,7 +144,7 @@ class ManagerTest extends TestCase {
$this->assertArrayHasKey($check2, $data);
}
- public function testScope() {
+ public function testScope(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -178,7 +178,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($this->invokePrivate($this->manager, 'canModify', [$opId3, $userScope]));
}
- public function testGetAllOperations() {
+ public function testGetAllOperations(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -249,7 +249,7 @@ class ManagerTest extends TestCase {
$this->assertSame(2, count($userOps['OCA\WFE\TestUserOp']));
}
- public function testGetOperations() {
+ public function testGetOperations(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -319,7 +319,7 @@ class ManagerTest extends TestCase {
});
}
- public function testGetAllConfiguredEvents() {
+ public function testGetAllConfiguredEvents(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -353,7 +353,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($allOperationsCached, $allOperations);
}
- public function testUpdateOperation() {
+ public function testUpdateOperation(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -434,7 +434,7 @@ class ManagerTest extends TestCase {
}
}
- public function testDeleteOperation() {
+ public function testDeleteOperation(): void {
$adminScope = $this->buildScope();
$userScope = $this->buildScope('jackie');
$entity = File::class;
@@ -484,7 +484,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetEntitiesListBuildInOnly() {
+ public function testGetEntitiesListBuildInOnly(): void {
$fileEntityMock = $this->createMock(File::class);
$this->container->expects($this->once())
@@ -498,7 +498,7 @@ class ManagerTest extends TestCase {
$this->assertInstanceOf(IEntity::class, $entities[0]);
}
- public function testGetEntitiesList() {
+ public function testGetEntitiesList(): void {
$fileEntityMock = $this->createMock(File::class);
$this->container->expects($this->once())
@@ -532,7 +532,7 @@ class ManagerTest extends TestCase {
$this->assertSame(1, $entityTypeCounts[1]);
}
- public function testValidateOperationOK() {
+ public function testValidateOperationOK(): void {
$check = [
'class' => ICheck::class,
'operator' => 'is',
@@ -592,7 +592,7 @@ class ManagerTest extends TestCase {
$this->manager->validateOperation(IOperation::class, 'test', [$check], 'operationData', $scopeMock, IEntity::class, ['MyEvent']);
}
- public function testValidateOperationCheckInputLengthError() {
+ public function testValidateOperationCheckInputLengthError(): void {
$check = [
'class' => ICheck::class,
'operator' => 'is',
@@ -656,7 +656,7 @@ class ManagerTest extends TestCase {
}
}
- public function testValidateOperationDataLengthError() {
+ public function testValidateOperationDataLengthError(): void {
$check = [
'class' => ICheck::class,
'operator' => 'is',
@@ -720,7 +720,7 @@ class ManagerTest extends TestCase {
}
}
- public function testValidateOperationScopeNotAvailable() {
+ public function testValidateOperationScopeNotAvailable(): void {
$check = [
'class' => ICheck::class,
'operator' => 'is',