upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:15:59 +00:00
parent bf715bc387
commit 2fb1a687ef
11 changed files with 69 additions and 145 deletions

View File

@ -34,10 +34,10 @@ use phpOMS\System\MimeType;
use phpOMS\Utils\TestUtils;
/**
* @testdox Modules\Comments\tests\Controller\ApiControllerTest: Comments api controller
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Controller\ApiController::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\Comments\tests\Controller\ApiControllerTest: Comments api controller')]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{
protected ApplicationAbstract $app;
@ -92,10 +92,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
TestUtils::setMember($this->module, 'app', $this->app);
}
/**
* @covers \Modules\Comments\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiCommentListCU() : void
{
$response = new HttpResponse();
@ -123,10 +120,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(2, $response->getDataArray('')['response']->status);
}
/**
* @covers \Modules\Comments\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiCommentCRU() : void
{
// create
@ -189,10 +183,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('New plain', $response->getDataArray('')['response']->contentRaw);
}
/**
* @covers \Modules\Comments\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiCommentCreateInvalidData() : void
{
$response = new HttpResponse();
@ -205,10 +196,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\Comments\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiCommentVoteCreateInvalidData() : void
{
$response = new HttpResponse();
@ -221,10 +209,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\Comments\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiCommentVoteCreate() : void
{
$response = new HttpResponse();

View File

@ -22,12 +22,10 @@ use Modules\Comments\Models\CommentListMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentListMapper::class)]
final class CommentListMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Comments\Models\CommentListMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$list = new CommentList();

View File

@ -20,6 +20,7 @@ use Modules\Comments\Models\CommentList;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentList::class)]
final class CommentListTest extends \PHPUnit\Framework\TestCase
{
private CommentList $list;
@ -32,20 +33,14 @@ final class CommentListTest extends \PHPUnit\Framework\TestCase
$this->list = new CommentList();
}
/**
* @covers \Modules\Comments\Models\CommentList
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->list->id);
self::assertEquals([], $this->list->getComments());
}
/**
* @covers \Modules\Comments\Models\CommentList
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testGetSet() : void
{
$comment = new Comment();

View File

@ -22,12 +22,10 @@ use Modules\Comments\Models\CommentMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentMapper::class)]
final class CommentMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Comments\Models\CommentMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$comment = new Comment();

View File

@ -22,6 +22,7 @@ use Modules\Comments\Models\NullComment;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\Comment::class)]
final class CommentTest extends \PHPUnit\Framework\TestCase
{
private Comment $comment;
@ -34,10 +35,7 @@ final class CommentTest extends \PHPUnit\Framework\TestCase
$this->comment = new Comment();
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->comment->id);
@ -52,30 +50,21 @@ final class CommentTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->comment->files);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreatedByInputOutput() : void
{
$this->comment->createdBy = new NullAccount(1);
self::assertEquals(1, $this->comment->createdBy->id);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testListInputOutput() : void
{
$this->comment->list = 3;
self::assertEquals(3, $this->comment->list);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testRefInputOutput() : void
{
$this->comment->ref = 2;
@ -85,30 +74,21 @@ final class CommentTest extends \PHPUnit\Framework\TestCase
self::assertEquals(3, $this->comment->ref->id);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testTitleInputOutput() : void
{
$this->comment->title = 'Test Title';
self::assertEquals('Test Title', $this->comment->title);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testContentInputOutput() : void
{
$this->comment->content = 'Test Content';
self::assertEquals('Test Content', $this->comment->content);
}
/**
* @covers \Modules\Comments\Models\Comment
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->comment->title = 'Title';

View File

@ -25,12 +25,10 @@ use Modules\Comments\Models\CommentVoteMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentVoteMapper::class)]
final class CommentVoteMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Comments\Models\CommentVoteMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCR() : void
{
$list = new CommentList();

View File

@ -19,6 +19,7 @@ use Modules\Comments\Models\CommentVote;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentVote::class)]
final class CommentVoteTest extends \PHPUnit\Framework\TestCase
{
private CommentVote $vote;
@ -31,10 +32,7 @@ final class CommentVoteTest extends \PHPUnit\Framework\TestCase
$this->vote = new CommentVote();
}
/**
* @covers \Modules\Comments\Models\CommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->vote->id);
@ -44,20 +42,14 @@ final class CommentVoteTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\DateTimeImmutable', $this->vote->createdAt);
}
/**
* @covers \Modules\Comments\Models\CommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testScoreInputOutput() : void
{
$this->vote->score = 1;
self::assertEquals(1, $this->vote->score);
}
/**
* @covers \Modules\Comments\Models\CommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCommentInputOutput() : void
{
$this->vote->comment = 1;

View File

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

View File

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

View File

@ -19,31 +19,23 @@ use Modules\Comments\Models\NullCommentVote;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\NullCommentVote::class)]
final class NullCommentVoteTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Comments\Models\NullCommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Comments\Models\CommentVote', new NullCommentVote());
}
/**
* @covers \Modules\Comments\Models\NullCommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullCommentVote(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\Comments\Models\NullCommentVote
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullCommentVote(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>