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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,31 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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" processUncoveredFiles="false"> <coverage includeUncoveredFiles="true">
<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>
<report> <report>
<clover outputFile="coverage.xml"/> <clover outputFile="coverage.xml"/>
<html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/> <html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/>
@ -56,4 +31,31 @@
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/> <const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
<const name="RESET" value="1"/> <const name="RESET" value="1"/>
</php> </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> </phpunit>