upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:15:59 +00:00
parent 8d7dc83058
commit 5c41e7a843
12 changed files with 75 additions and 158 deletions

View File

@ -35,6 +35,7 @@ use phpOMS\Utils\TestUtils;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Controller\ApiController::class)]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{
protected ApplicationAbstract $app;
@ -88,10 +89,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
TestUtils::setMember($this->module, 'app', $this->app);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiBoardCU() : void
{
$response = new HttpResponse();
@ -119,10 +117,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('New Controller Test Board', $response->getDataArray('')['response']->name);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreateColumn() : void
{
$response = new HttpResponse();
@ -138,10 +133,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreateCard() : void
{
$response = new HttpResponse();
@ -175,10 +167,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiKanbanBoardCreateInvalidData() : void
{
$response = new HttpResponse();
@ -191,10 +180,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiKanbanColumnCreateInvalidData() : void
{
$response = new HttpResponse();
@ -207,10 +193,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\Kanban\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiKanbanCardCreateInvalidData() : void
{
$response = new HttpResponse();

View File

@ -21,12 +21,10 @@ use Modules\Kanban\Models\KanbanBoardMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanBoardMapper::class)]
final class KanbanBoardMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Kanban\Models\KanbanBoardMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$board = new KanbanBoard();

View File

@ -21,6 +21,7 @@ use Modules\Kanban\Models\NullKanbanColumn;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanBoard::class)]
final class KanbanBoardTest extends \PHPUnit\Framework\TestCase
{
private KanbanBoard $board;
@ -33,10 +34,7 @@ final class KanbanBoardTest extends \PHPUnit\Framework\TestCase
$this->board = new KanbanBoard();
}
/**
* @covers \Modules\Kanban\Models\KanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->board->id);
@ -48,20 +46,14 @@ final class KanbanBoardTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->board->getColumns());
}
/**
* @covers \Modules\Kanban\Models\KanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testColumnsInputOutput() : void
{
$this->board->addColumn($column = new NullKanbanColumn(2));
self::assertEquals([$column], $this->board->getColumns());
}
/**
* @covers \Modules\Kanban\Models\KanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testColumnRemove() : void
{
$this->board->addColumn(new NullKanbanColumn(2));
@ -70,10 +62,7 @@ final class KanbanBoardTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->board->removeColumn(0));
}
/**
* @covers \Modules\Kanban\Models\KanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->board->status = BoardStatus::ARCHIVED;

View File

@ -21,13 +21,11 @@ use Modules\Kanban\Models\KanbanCardCommentMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanCardCommentMapper::class)]
final class KanbanCardCommentMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @depends Modules\Kanban\tests\Models\KanbanCardMapperTest::testCRUD
* @covers \Modules\Kanban\Models\KanbanCardCommentMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\DependsExternal('\Modules\Kanban\tests\Models\KanbanCardMapperTest', 'testCRUD')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$comment = new KanbanCardComment();

View File

@ -24,13 +24,11 @@ use Modules\Tag\Models\Tag;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanCardMapper::class)]
final class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @depends Modules\Kanban\tests\Models\KanbanCardMapperTest::testCRUD
* @covers \Modules\Kanban\Models\KanbanCardMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\DependsExternal('\Modules\Kanban\tests\Models\KanbanColumnMapperTest', 'testCRUD')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$card = new KanbanCard();
@ -61,10 +59,7 @@ final class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
self::assertEquals($card->ref, $cardR->ref);
}
/**
* @covers \Modules\Kanban\Models\KanbanCardMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testTaskCard() : void
{
$card = new KanbanCard();

View File

@ -23,6 +23,7 @@ use Modules\Tasks\Models\Task;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanCard::class)]
final class KanbanCardTest extends \PHPUnit\Framework\TestCase
{
private KanbanCard $card;
@ -35,10 +36,7 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase
$this->card = new KanbanCard();
}
/**
* @covers \Modules\Kanban\Models\KanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->card->id);
@ -54,29 +52,20 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->card->files);
}
/**
* @covers \Modules\Kanban\Models\KanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testColumnInputOutput() : void
{
$this->card->column = 1;
self::assertEquals(1, $this->card->column);
}
/**
* @covers \Modules\Kanban\Models\KanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreateFromTask() : void
{
self::assertInstanceOf('\Modules\Kanban\Models\KanbanCard', $this->card->createFromTask(new Task()));
}
/**
* @covers \Modules\Kanban\Models\KanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->card->name = 'Title';

View File

@ -20,13 +20,11 @@ use Modules\Kanban\Models\KanbanColumnMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanColumnMapper::class)]
final class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @depends Modules\Kanban\tests\Models\KanbanBoardMapperTest::testCRUD
* @covers \Modules\Kanban\Models\KanbanColumnMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\DependsExternal('\Modules\Kanban\tests\Models\KanbanBoardMapperTest', 'testCRUD')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$column = new KanbanColumn();

View File

@ -20,6 +20,7 @@ use Modules\Kanban\Models\KanbanColumn;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\KanbanColumn::class)]
final class KanbanColumnTest extends \PHPUnit\Framework\TestCase
{
private KanbanColumn $column;
@ -32,10 +33,7 @@ final class KanbanColumnTest extends \PHPUnit\Framework\TestCase
$this->column = new KanbanColumn();
}
/**
* @covers \Modules\Kanban\Models\KanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->column->id);
@ -45,20 +43,14 @@ final class KanbanColumnTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->column->getCards());
}
/**
* @covers \Modules\Kanban\Models\KanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCardInputOutput() : void
{
$this->column->addCard(new KanbanCard());
self::assertCount(1, $this->column->getCards());
}
/**
* @covers \Modules\Kanban\Models\KanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCardRemove() : void
{
$this->column->addCard(new KanbanCard());
@ -68,10 +60,7 @@ final class KanbanColumnTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->column->removeCard(0));
}
/**
* @covers \Modules\Kanban\Models\KanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->column->name = 'Name';

View File

@ -19,31 +19,23 @@ use Modules\Kanban\Models\NullKanbanBoard;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\NullKanbanBoard::class)]
final class NullKanbanBoardTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Kanban\Models\NullKanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Kanban\Models\KanbanBoard', new NullKanbanBoard());
}
/**
* @covers \Modules\Kanban\Models\NullKanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullKanbanBoard(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\Kanban\Models\NullKanbanBoard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullKanbanBoard(2);

View File

@ -19,31 +19,23 @@ use Modules\Kanban\Models\NullKanbanCard;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\NullKanbanCard::class)]
final class NullKanbanCardTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Kanban\Models\NullKanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Kanban\Models\KanbanCard', new NullKanbanCard());
}
/**
* @covers \Modules\Kanban\Models\NullKanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullKanbanCard(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\Kanban\Models\NullKanbanCard
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullKanbanCard(2);

View File

@ -19,31 +19,23 @@ use Modules\Kanban\Models\NullKanbanColumn;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Kanban\Models\NullKanbanColumn::class)]
final class NullKanbanColumnTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Kanban\Models\NullKanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Kanban\Models\KanbanColumn', new NullKanbanColumn());
}
/**
* @covers \Modules\Kanban\Models\NullKanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullKanbanColumn(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\Kanban\Models\NullKanbanColumn
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullKanbanColumn(2);

View File

@ -1,31 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
<include>
<directory suffix=".php">../</directory>
</include>
<exclude>
<directory>../vendor*</directory>
<directory>../MainRepository*</directory>
<directory>../Karaka*</directory>
<directory>../Admin/Install/Application*</directory>
<directory>../phpOMS*</directory>
<directory>../tests*</directory>
<directory>../*/tests*</directory>
<directory>../**/tests*</directory>
<directory>*/tests*</directory>
<directory suffix="tpl.php">../*</directory>
<directory suffix="lang.php">../*</directory>
<directory suffix="Test.php">../*</directory>
<directory suffix="Routes.php">../*</directory>
<directory suffix="Hooks.php">../*</directory>
<directory>../**/test*</directory>
<directory>../**/Theme*</directory>
<directory>../**/Admin/Routes*</directory>
<directory>../**/Admin/Hooks*</directory>
<directory>../**/Admin/Install*</directory>
<directory>../Media/Files*</directory>
</exclude>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="coverage.xml"/>
<html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/>
@ -56,4 +31,31 @@
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
<const name="RESET" value="1"/>
</php>
<source>
<include>
<directory suffix=".php">../</directory>
</include>
<exclude>
<directory>../vendor*</directory>
<directory>../MainRepository*</directory>
<directory>../Karaka*</directory>
<directory>../Admin/Install/Application*</directory>
<directory>../phpOMS*</directory>
<directory>../tests*</directory>
<directory>../*/tests*</directory>
<directory>../**/tests*</directory>
<directory>*/tests*</directory>
<directory suffix="tpl.php">../*</directory>
<directory suffix="lang.php">../*</directory>
<directory suffix="Test.php">../*</directory>
<directory suffix="Routes.php">../*</directory>
<directory suffix="Hooks.php">../*</directory>
<directory>../**/test*</directory>
<directory>../**/Theme*</directory>
<directory>../**/Admin/Routes*</directory>
<directory>../**/Admin/Hooks*</directory>
<directory>../**/Admin/Install*</directory>
<directory>../Media/Files*</directory>
</exclude>
</source>
</phpunit>