test fixes

This commit is contained in:
Dennis Eichhorn 2024-03-17 03:57:41 +00:00
parent a57147863b
commit f71c28f499
24 changed files with 1 additions and 700 deletions

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -1,25 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Kanban' => [
'Archive' => '',
'Back' => '',
'Date' => '',
'Description' => '',
'Kanban' => '',
'Name' => '',
'Status' => '',
'Tags' => '',
'Title' => '',
]];

View File

@ -175,39 +175,6 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
* @covers Modules\Kanban\Controller\ApiController
* @group module
*/
public function testCreateCommentCard() : void
{
$response = new HttpResponse();
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('plain', 'Controller Test Description');
$request->setData('card', '1');
if (!\is_file(__DIR__ . '/test_tmp.md')) {
\copy(__DIR__ . '/test.md', __DIR__ . '/test_tmp.md');
}
TestUtils::setMember($request, 'files', [
'file1' => [
'name' => 'test.md',
'type' => MimeType::M_TXT,
'tmp_name' => __DIR__ . '/test_tmp.md',
'error' => \UPLOAD_ERR_OK,
'size' => \filesize(__DIR__ . '/test_tmp.md'),
],
]);
$request->setData('media', \json_encode([1]));
$this->module->apiKanbanCardCommentCreate($request, $response);
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
* @covers Modules\Kanban\Controller\ApiController
* @group module
@ -255,20 +222,4 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiKanbanCardCreate($request, $response);
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers Modules\Kanban\Controller\ApiController
* @group module
*/
public function testApiKanbanCardCommentCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
$this->module->apiKanbanCardCommentCreate($request, $response);
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
}

View File

@ -1,73 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Kanban\tests\Models;
use Modules\Kanban\Models\KanbanCardComment;
/**
* @internal
*/
final class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase
{
private KanbanCardComment $comment;
/**
* {@inheritdoc}
*/
protected function setUp() : void
{
$this->comment = new KanbanCardComment();
}
/**
* @covers Modules\Kanban\Models\KanbanCardComment
* @group module
*/
public function testDefault() : void
{
self::assertEquals(0, $this->comment->id);
self::assertEquals(0, $this->comment->card);
self::assertEquals('', $this->comment->description);
self::assertEquals(0, $this->comment->createdBy->id);
self::assertInstanceOf('\DateTimeImmutable', $this->comment->createdAt);
self::assertEquals([], $this->comment->files);
}
/**
* @covers Modules\Kanban\Models\KanbanCardComment
* @group module
*/
public function testSerialize() : void
{
$this->comment->description = 'Description';
$this->comment->descriptionRaw = 'DescriptionRaw';
$this->comment->card = 2;
$serialized = $this->comment->jsonSerialize();
unset($serialized['createdBy']);
unset($serialized['createdAt']);
self::assertEquals(
[
'id' => 0,
'description' => 'Description',
'descriptionRaw' => 'DescriptionRaw',
'card' => 2,
'media' => [],
],
$serialized
);
}
}

View File

@ -50,7 +50,6 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $this->card->order);
self::assertEquals(0, $this->card->createdBy->id);
self::assertInstanceOf('\DateTimeImmutable', $this->card->createdAt);
self::assertEquals([], $this->card->getComments());
self::assertEquals([], $this->card->tags);
self::assertEquals([], $this->card->files);
}
@ -65,30 +64,6 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1, $this->card->column);
}
/**
* @covers Modules\Kanban\Models\KanbanCard
* @group module
*/
public function testCommentInputOutput() : void
{
$this->card->addComment($card = new NullKanbanCardComment(5));
self::assertEquals([$card], $this->card->getComments());
self::assertEquals(1, $this->card->getCommentCount());
}
/**
* @covers Modules\Kanban\Models\KanbanCard
* @group module
*/
public function testCommentRemove() : void
{
$this->card->addComment($comment = new NullKanbanCardComment(5));
self::assertCount(1, $this->card->getComments());
self::assertTrue($this->card->removeComment(0));
self::assertCount(0, $this->card->getComments());
self::assertFalse($this->card->removeComment(0));
}
/**
* @covers Modules\Kanban\Models\KanbanCard
* @group module
@ -127,7 +102,7 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase
'column' => 2,
'order' => 3,
'ref' => 0,
'comments' => [],
'comments' => null,
'media' => [],
],
$serialized

View File

@ -1,52 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Kanban\tests\Models;
use Modules\Kanban\Models\NullKanbanCardComment;
/**
* @internal
*/
final class NullKanbanCardCommentTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers Modules\Kanban\Models\NullKanbanCardComment
* @group module
*/
public function testNull() : void
{
self::assertInstanceOf('\Modules\Kanban\Models\KanbanCardComment', new NullKanbanCardComment());
}
/**
* @covers Modules\Kanban\Models\NullKanbanCardComment
* @group module
*/
public function testId() : void
{
$null = new NullKanbanCardComment(2);
self::assertEquals(2, $null->id);
}
/**
* @covers Modules\Kanban\Models\NullKanbanCardComment
* @group module
*/
public function testJsonSerialize() : void
{
$null = new NullKanbanCardComment(2);
self::assertEquals(['id' => 2], $null->jsonSerialize());
}
}