From 1fefab557958e177a527fa1a542abfd24a196a24 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 20 Mar 2024 05:16:00 +0000 Subject: [PATCH] upgrade phpunit --- tests/Controller/ApiControllerTest.php | 36 ++++------------- tests/Models/NullTagTest.php | 16 ++------ tests/Models/TagL11nMapperTest.php | 6 +-- tests/Models/TagMapperTest.php | 6 +-- tests/Models/TagTest.php | 26 +++--------- tests/phpunit_default.xml | 56 +++++++++++++------------- 6 files changed, 51 insertions(+), 95 deletions(-) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 7ef00df..58d2745 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -34,6 +34,7 @@ use phpOMS\Utils\TestUtils; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tag\Controller\ApiController::class)] final class ApiControllerTest extends \PHPUnit\Framework\TestCase { protected $app = null; @@ -92,10 +93,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase **/ private static int $tagId = 0; - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagCreate() : void { $response = new HttpResponse(); @@ -114,10 +112,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::$tagId = $response->getDataArray('')['response']->id; } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagCreateInvalid() : void { $response = new HttpResponse(); @@ -128,10 +123,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagL11nCreate() : void { $response = new HttpResponse(); @@ -148,10 +140,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagL11nCreateInvalid() : void { $response = new HttpResponse(); @@ -162,10 +151,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagGet() : void { $response = new HttpResponse(); @@ -179,10 +165,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(self::$tagId, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTagUpdate() : void { $response = new HttpResponse(); @@ -198,10 +181,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(self::$tagId, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\Tag\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiUnitFind() : void { $response = new HttpResponse(); diff --git a/tests/Models/NullTagTest.php b/tests/Models/NullTagTest.php index 2a65c68..d6d0355 100755 --- a/tests/Models/NullTagTest.php +++ b/tests/Models/NullTagTest.php @@ -19,31 +19,23 @@ use Modules\Tag\Models\NullTag; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tag\Models\NullTag::class)] final class NullTagTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Tag\Models\NullTag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Tag\Models\Tag', new NullTag()); } - /** - * @covers \Modules\Tag\Models\NullTag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullTag(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Tag\Models\NullTag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullTag(2); diff --git a/tests/Models/TagL11nMapperTest.php b/tests/Models/TagL11nMapperTest.php index a901a47..3d2df6f 100755 --- a/tests/Models/TagL11nMapperTest.php +++ b/tests/Models/TagL11nMapperTest.php @@ -24,12 +24,10 @@ use phpOMS\Localization\ISO639x1Enum; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tag\Models\TagL11nMapper::class)] final class TagL11nMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Tag\Models\TagL11nMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCR() : void { $tag = new Tag(); diff --git a/tests/Models/TagMapperTest.php b/tests/Models/TagMapperTest.php index 87481ef..562b01e 100755 --- a/tests/Models/TagMapperTest.php +++ b/tests/Models/TagMapperTest.php @@ -22,12 +22,10 @@ use phpOMS\Localization\ISO639x1Enum; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tag\Models\TagMapper::class)] final class TagMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Tag\Models\TagMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCR() : void { $tag = new Tag(); diff --git a/tests/Models/TagTest.php b/tests/Models/TagTest.php index ea67c9d..d5aebcd 100755 --- a/tests/Models/TagTest.php +++ b/tests/Models/TagTest.php @@ -22,6 +22,7 @@ use phpOMS\Localization\BaseStringL11n; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tag\Models\Tag::class)] final class TagTest extends \PHPUnit\Framework\TestCase { private Tag $tag; @@ -34,10 +35,7 @@ final class TagTest extends \PHPUnit\Framework\TestCase $this->tag = new Tag(); } - /** - * @covers \Modules\Tag\Models\Tag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->tag->id); @@ -47,10 +45,7 @@ final class TagTest extends \PHPUnit\Framework\TestCase self::assertEquals('', $this->tag->getL11n()); } - /** - * @covers \Modules\Tag\Models\Tag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testTitleInputOutput() : void { $this->tag->setL11n('Test'); @@ -63,30 +58,21 @@ final class TagTest extends \PHPUnit\Framework\TestCase self::assertEquals('Test3', $this->tag->getL11n()); } - /** - * @covers \Modules\Tag\Models\Tag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testOwnerInputOutput() : void { $this->tag->owner = new NullAccount(2); self::assertEquals(2, $this->tag->owner->id); } - /** - * @covers \Modules\Tag\Models\Tag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testColorInputOutput() : void { $this->tag->color = 'ffffffff'; self::assertEquals('ffffffff', $this->tag->color); } - /** - * @covers \Modules\Tag\Models\Tag - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->tag->setL11n($t = new BaseStringL11n('Test')); diff --git a/tests/phpunit_default.xml b/tests/phpunit_default.xml index d350430..e4a5639 100755 --- a/tests/phpunit_default.xml +++ b/tests/phpunit_default.xml @@ -1,31 +1,6 @@ - - - - ../ - - - ../vendor* - ../MainRepository* - ../Karaka* - ../Admin/Install/Application* - ../phpOMS* - ../tests* - ../*/tests* - ../**/tests* - */tests* - ../* - ../* - ../* - ../* - ../* - ../**/test* - ../**/Theme* - ../**/Admin/Routes* - ../**/Admin/Hooks* - ../**/Admin/Install* - ../Media/Files* - + + @@ -56,4 +31,31 @@ + + + ../ + + + ../vendor* + ../MainRepository* + ../Karaka* + ../Admin/Install/Application* + ../phpOMS* + ../tests* + ../*/tests* + ../**/tests* + */tests* + ../* + ../* + ../* + ../* + ../* + ../**/test* + ../**/Theme* + ../**/Admin/Routes* + ../**/Admin/Hooks* + ../**/Admin/Install* + ../Media/Files* + +