fix tests

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier
2024-02-03 13:59:32 +01:00
parent 4325dda4db
commit c0b6df3406
5 changed files with 14 additions and 14 deletions

View File

@@ -3,7 +3,7 @@
<id>cospend</id>
<name>Cospend</name>
<summary> </summary><description> </description>
<version>1.6.0</version>
<version>1.6.1</version>
<licence>agpl</licence>
<author mail="julien-nc@posteo.net">Julien Veyssier</author>
<namespace>Cospend</namespace>

View File

@@ -66,7 +66,7 @@ class CospendProvider implements IProvider {
* @throws InvalidArgumentException Should be thrown if your provider does not know this event
* @since 11.0.0
*/
public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'cospend') {
throw new InvalidArgumentException();
}

View File

@@ -1437,7 +1437,7 @@ class ApiController extends OCSController {
#[CORS]
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT, tags: ['Sharing'])]
public function getPublicFileShare(string $path): DataResponse {
$cleanPath = str_replace(array('../', '..\\'), '', $path);
$cleanPath = str_replace(['../', '..\\'], '', $path);
$userFolder = $this->root->getUserFolder($this->userId);
if (!$userFolder->nodeExists($cleanPath)) {
return new DataResponse(['message' => $this->trans->t('Access denied')], Http::STATUS_UNAUTHORIZED);

View File

@@ -1030,7 +1030,7 @@ class ApiControllerTest extends TestCase {
// delete bill when deletion is disabled
$resp = $this->apiController->editProject(
'superproj', null, null, null,
'superproj', null, null,
null, true,
);
$status = $resp->getStatus();
@@ -1043,7 +1043,7 @@ class ApiControllerTest extends TestCase {
$this->assertEquals('', $data);
// reset bill deletion in project
$resp = $this->apiController->editProject(
'superproj', null, null, null,
'superproj', null, null,
null, false,
);
$status = $resp->getStatus();
@@ -1063,7 +1063,7 @@ class ApiControllerTest extends TestCase {
// EDIT PROJECT
$resp = $this->apiController->editProject(
'superproj', 'newname', 'email@yep.yop',
'superproj', 'newname',
Application::FREQUENCY_MONTHLY, '', false,
Application::SORT_ORDER_MANUAL, Application::SORT_ORDER_MANUAL
);
@@ -1078,12 +1078,12 @@ class ApiControllerTest extends TestCase {
$this->assertEquals(Http::STATUS_BAD_REQUEST, $status);
// user can't edit this project (test is not the owner of superprojLALA)
// $resp = $this->apiController->editProject('superprojLALA', 'newname', 'new email');
// $resp = $this->apiController->editProject('superprojLALA', 'newname');
// $status = $resp->getStatus();
// $this->assertEquals(Http::STATUS_UNAUTHORIZED, $status);
// project does not exist
// $resp = $this->apiController->editProject('doesnotexit', 'newname', 'new email');
// $resp = $this->apiController->editProject('doesnotexit', 'newname');
// $status = $resp->getStatus();
// $this->assertEquals(Http::STATUS_UNAUTHORIZED, $status);
@@ -1092,13 +1092,13 @@ class ApiControllerTest extends TestCase {
$this->assertFalse(isset($res['success']));
// invalid name
$resp = $this->apiController->editProject('superproj', '', 'new email');
$resp = $this->apiController->editProject('superproj', '');
$status = $resp->getStatus();
$this->assertEquals(Http::STATUS_BAD_REQUEST, $status);
// invalid category sort
$resp = $this->apiController->editProject(
'superproj', 'newname', 'email@yep.yop',
'superproj', 'newname',
Application::FREQUENCY_MONTHLY, 'euro', null,
'zzz', Application::SORT_ORDER_MANUAL
);
@@ -1107,7 +1107,7 @@ class ApiControllerTest extends TestCase {
// invalid payment mode sort
$resp = $this->apiController->editProject(
'superproj', 'newname', 'email@yep.yop',
'superproj', 'newname',
Application::FREQUENCY_MONTHLY, 'euro', null,
Application::SORT_ORDER_MANUAL, 'zzz'
);
@@ -1116,7 +1116,7 @@ class ApiControllerTest extends TestCase {
// invalid auto export frequency
$resp = $this->apiController->editProject(
'superproj', 'newname', 'email@yep.yop',
'superproj', 'newname',
'zzz', 'euro', null,
Application::SORT_ORDER_MANUAL, Application::SORT_ORDER_MANUAL
);

View File

@@ -15,7 +15,7 @@ namespace OC\Core\Command {
protected string $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN;
public function __construct(string $name = null) {
public function __construct(?string $name = null) {
}
protected function configure() {
@@ -30,7 +30,7 @@ namespace OC\Core\Command {
public function getDefinition(): InputDefinition {
}
public function addArgument(string $name, int $mode = null, string $description = '', $default = null) {
public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null) {
}
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, array $items, string $prefix = ' - '): void {