From 374d34901c08d94f80468756e3a5e4331ad4e316 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 20 Mar 2024 05:16:00 +0000 Subject: [PATCH] upgrade phpunit --- .../Api/ApiControllerTicketTrait.php | 16 +++--- tests/Controller/ApiControllerTest.php | 3 +- tests/Models/NullSupportAppTest.php | 16 ++---- tests/Models/NullTicketElementTest.php | 16 ++---- tests/Models/NullTicketTest.php | 16 ++---- tests/Models/SupportAppTest.php | 11 +--- tests/Models/TicketElementTest.php | 11 +--- tests/Models/TicketTest.php | 21 ++----- tests/Views/TicketViewTest.php | 11 +--- tests/phpunit_default.xml | 56 ++++++++++--------- 10 files changed, 64 insertions(+), 113 deletions(-) diff --git a/tests/Controller/Api/ApiControllerTicketTrait.php b/tests/Controller/Api/ApiControllerTicketTrait.php index 7a5e2e6..27b073d 100755 --- a/tests/Controller/Api/ApiControllerTicketTrait.php +++ b/tests/Controller/Api/ApiControllerTicketTrait.php @@ -23,8 +23,8 @@ trait ApiControllerTicketTrait { /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSupportAppCreate() : void { $response = new HttpResponse(); @@ -39,8 +39,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSupportAppCreateInvalidData() : void { $response = new HttpResponse(); @@ -55,8 +55,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketCreate() : void { $response = new HttpResponse(); @@ -74,8 +74,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketGet() : void { $response = new HttpResponse(); @@ -90,8 +90,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketCreateInvalidData() : void { $response = new HttpResponse(); @@ -106,8 +106,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketElementCreate() : void { $response = new HttpResponse(); @@ -125,8 +125,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketElementGet() : void { $response = new HttpResponse(); @@ -141,8 +141,8 @@ trait ApiControllerTicketTrait /** * @covers \Modules\Support\Controller\ApiController - * @group module */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiTicketElementCreateInvalidData() : void { $response = new HttpResponse(); diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 00471ad..ddf95a6 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -31,10 +31,9 @@ use phpOMS\Router\WebRouter; use phpOMS\Utils\TestUtils; /** - * @testdox Modules\Support\tests\Controller\ApiControllerTest: Support api controller - * * @internal */ +#[\PHPUnit\Framework\Attributes\TestDox('Modules\Support\tests\Controller\ApiControllerTest: Support api controller')] final class ApiControllerTest extends \PHPUnit\Framework\TestCase { protected ApplicationAbstract $app; diff --git a/tests/Models/NullSupportAppTest.php b/tests/Models/NullSupportAppTest.php index e166389..b3c9a33 100755 --- a/tests/Models/NullSupportAppTest.php +++ b/tests/Models/NullSupportAppTest.php @@ -19,31 +19,23 @@ use Modules\Support\Models\NullSupportApp; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\NullSupportApp::class)] final class NullSupportAppTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Support\Models\NullSupportApp - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Support\Models\SupportApp', new NullSupportApp()); } - /** - * @covers \Modules\Support\Models\NullSupportApp - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullSupportApp(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Support\Models\NullSupportApp - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullSupportApp(2); diff --git a/tests/Models/NullTicketElementTest.php b/tests/Models/NullTicketElementTest.php index 37e6dc3..d987667 100755 --- a/tests/Models/NullTicketElementTest.php +++ b/tests/Models/NullTicketElementTest.php @@ -19,31 +19,23 @@ use Modules\Support\Models\NullTicketElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\NullTicketElement::class)] final class NullTicketElementTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Support\Models\NullTicketElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Support\Models\TicketElement', new NullTicketElement()); } - /** - * @covers \Modules\Support\Models\NullTicketElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullTicketElement(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Support\Models\NullTicketElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullTicketElement(2); diff --git a/tests/Models/NullTicketTest.php b/tests/Models/NullTicketTest.php index cb71d49..2bd4b54 100755 --- a/tests/Models/NullTicketTest.php +++ b/tests/Models/NullTicketTest.php @@ -19,31 +19,23 @@ use Modules\Support\Models\NullTicket; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\NullTicket::class)] final class NullTicketTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Support\Models\NullTicket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Support\Models\Ticket', new NullTicket()); } - /** - * @covers \Modules\Support\Models\NullTicket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullTicket(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Support\Models\NullTicket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullTicket(2); diff --git a/tests/Models/SupportAppTest.php b/tests/Models/SupportAppTest.php index 8b72aeb..a2b11a6 100755 --- a/tests/Models/SupportAppTest.php +++ b/tests/Models/SupportAppTest.php @@ -19,6 +19,7 @@ use Modules\Support\Models\SupportApp; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\SupportApp::class)] final class SupportAppTest extends \PHPUnit\Framework\TestCase { private SupportApp $app; @@ -31,20 +32,14 @@ final class SupportAppTest extends \PHPUnit\Framework\TestCase $this->app = new SupportApp(); } - /** - * @covers \Modules\Support\Models\SupportApp - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->app->id); self::assertEquals('', $this->app->name); } - /** - * @covers \Modules\Support\Models\SupportApp - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->app->name = 'Test Title'; diff --git a/tests/Models/TicketElementTest.php b/tests/Models/TicketElementTest.php index 23e9f10..2708ab2 100755 --- a/tests/Models/TicketElementTest.php +++ b/tests/Models/TicketElementTest.php @@ -19,6 +19,7 @@ use Modules\Support\Models\TicketElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\TicketElement::class)] final class TicketElementTest extends \PHPUnit\Framework\TestCase { private TicketElement $element; @@ -31,20 +32,14 @@ final class TicketElementTest extends \PHPUnit\Framework\TestCase $this->element = new TicketElement(); } - /** - * @covers \Modules\Support\Models\TicketElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->element->id); self::assertEquals(0, $this->element->ticket); } - /** - * @covers \Modules\Support\Models\TicketElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->element->ticket = 2; diff --git a/tests/Models/TicketTest.php b/tests/Models/TicketTest.php index e565960..1358c1c 100755 --- a/tests/Models/TicketTest.php +++ b/tests/Models/TicketTest.php @@ -20,6 +20,7 @@ use Modules\Support\Models\TicketElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Models\Ticket::class)] final class TicketTest extends \PHPUnit\Framework\TestCase { private Ticket $ticket; @@ -32,10 +33,7 @@ final class TicketTest extends \PHPUnit\Framework\TestCase $this->ticket = new Ticket(); } - /** - * @covers \Modules\Support\Models\Ticket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->ticket->id); @@ -46,10 +44,7 @@ final class TicketTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\Modules\Support\Models\SupportApp', $this->ticket->app); } - /** - * @covers \Modules\Support\Models\Ticket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testElementInputOutput() : void { $element1 = new TicketElement(); @@ -62,10 +57,7 @@ final class TicketTest extends \PHPUnit\Framework\TestCase self::assertEquals([$element2, $element1], $this->ticket->invertTicketElements()); } - /** - * @covers \Modules\Support\Models\Ticket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testElementRemove() : void { $element1 = new TicketElement(); @@ -77,10 +69,7 @@ final class TicketTest extends \PHPUnit\Framework\TestCase self::assertFalse($this->ticket->removeElement(0)); } - /** - * @covers \Modules\Support\Models\Ticket - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $serialized = $this->ticket->jsonSerialize(); diff --git a/tests/Views/TicketViewTest.php b/tests/Views/TicketViewTest.php index 36e5a7f..0391847 100755 --- a/tests/Views/TicketViewTest.php +++ b/tests/Views/TicketViewTest.php @@ -24,12 +24,10 @@ use Modules\Support\Views\TicketView; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Support\Views\TicketView::class)] class TicketViewTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Support\Views\TicketView - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { $view = new TicketView(); @@ -37,10 +35,7 @@ class TicketViewTest extends \PHPUnit\Framework\TestCase self::assertStringContainsString('', $view->getAccountImage(999)); } - /** - * @covers \Modules\Support\Views\TicketView - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testAccountImageUrl() : void { $media = new Media(); 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* + +