From 775b9faff43b6430bd2dbc1e05fa6839750422eb Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 20 Mar 2024 05:15:59 +0000 Subject: [PATCH] upgrade phpunit --- tests/Controller/ApiControllerTest.php | 24 +++------ tests/Models/DashboardBoardTest.php | 16 ++---- tests/Models/DashboardComponentTest.php | 11 ++-- tests/Models/NullDashboardBoardTest.php | 16 ++---- tests/Models/NullDashboardComponentTest.php | 16 ++---- tests/phpunit_default.xml | 56 +++++++++++---------- 6 files changed, 50 insertions(+), 89 deletions(-) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index b565ef7..8aeeb0d 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -33,10 +33,10 @@ use phpOMS\Router\WebRouter; use phpOMS\Utils\TestUtils; /** - * @testdox Modules\Dashboard\tests\Controller\ApiControllerTest: Dashboard api controller - * * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Dashboard\Controller\ApiController::class)] +#[\PHPUnit\Framework\Attributes\TestDox('Modules\Dashboard\tests\Controller\ApiControllerTest: Dashboard api controller')] final class ApiControllerTest extends \PHPUnit\Framework\TestCase { protected ApplicationAbstract $app; @@ -91,10 +91,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase TestUtils::setMember($this->module, 'app', $this->app); } - /** - * @covers \Modules\Dashboard\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiBoardCreate() : void { $response = new HttpResponse(); @@ -107,10 +104,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\Dashboard\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiBoardCreateInvalidData() : void { $response = new HttpResponse(); @@ -123,10 +117,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\Dashboard\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiComponentCreate() : void { $response = new HttpResponse(); @@ -141,10 +132,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\Dashboard\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiComponentCreateInvalidData() : void { $response = new HttpResponse(); diff --git a/tests/Models/DashboardBoardTest.php b/tests/Models/DashboardBoardTest.php index 203f2e0..572d458 100755 --- a/tests/Models/DashboardBoardTest.php +++ b/tests/Models/DashboardBoardTest.php @@ -22,6 +22,7 @@ use Modules\Dashboard\Models\DashboardComponent; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Dashboard\Models\DashboardBoard::class)] final class DashboardBoardTest extends \PHPUnit\Framework\TestCase { private DashboardBoard $board; @@ -34,10 +35,7 @@ final class DashboardBoardTest extends \PHPUnit\Framework\TestCase $this->board = new DashboardBoard(); } - /** - * @covers \Modules\Dashboard\Models\DashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->board->id); @@ -48,10 +46,7 @@ final class DashboardBoardTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\Modules\Dashboard\Models\NullDashboardComponent', $this->board->getComponent(0)); } - /** - * @covers \Modules\Dashboard\Models\DashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testComponentInputOutput() : void { $id = $this->board->addComponent($temp = new DashboardComponent()); @@ -61,10 +56,7 @@ final class DashboardBoardTest extends \PHPUnit\Framework\TestCase self::assertFalse($this->board->removeComponent($id)); } - /** - * @covers \Modules\Dashboard\Models\DashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->board->title = 'Title'; diff --git a/tests/Models/DashboardComponentTest.php b/tests/Models/DashboardComponentTest.php index 6e2f7fc..8b3ffcd 100755 --- a/tests/Models/DashboardComponentTest.php +++ b/tests/Models/DashboardComponentTest.php @@ -19,6 +19,7 @@ use Modules\Dashboard\Models\DashboardComponent; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Dashboard\Models\DashboardComponent::class)] final class DashboardComponentTest extends \PHPUnit\Framework\TestCase { private DashboardComponent $component; @@ -31,10 +32,7 @@ final class DashboardComponentTest extends \PHPUnit\Framework\TestCase $this->component = new DashboardComponent(); } - /** - * @covers \Modules\Dashboard\Models\DashboardComponent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->component->id); @@ -44,10 +42,7 @@ final class DashboardComponentTest extends \PHPUnit\Framework\TestCase self::assertEquals('', $this->component->component); } - /** - * @covers \Modules\Dashboard\Models\DashboardComponent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->component->board = 3; diff --git a/tests/Models/NullDashboardBoardTest.php b/tests/Models/NullDashboardBoardTest.php index d7675fc..96db91f 100755 --- a/tests/Models/NullDashboardBoardTest.php +++ b/tests/Models/NullDashboardBoardTest.php @@ -19,31 +19,23 @@ use Modules\Dashboard\Models\NullDashboardBoard; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Dashboard\Models\NullDashboardBoard::class)] final class NullDashboardBoardTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Dashboard\Models\NullDashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Dashboard\Models\DashboardBoard', new NullDashboardBoard()); } - /** - * @covers \Modules\Dashboard\Models\NullDashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullDashboardBoard(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Dashboard\Models\NullDashboardBoard - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullDashboardBoard(2); diff --git a/tests/Models/NullDashboardComponentTest.php b/tests/Models/NullDashboardComponentTest.php index 073da49..ea440bb 100755 --- a/tests/Models/NullDashboardComponentTest.php +++ b/tests/Models/NullDashboardComponentTest.php @@ -19,31 +19,23 @@ use Modules\Dashboard\Models\NullDashboardComponent; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Dashboard\Models\NullDashboardComponent::class)] final class NullDashboardComponentTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Dashboard\Models\NullDashboardComponent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Dashboard\Models\DashboardComponent', new NullDashboardComponent()); } - /** - * @covers \Modules\Dashboard\Models\NullDashboardComponent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullDashboardComponent(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Dashboard\Models\NullDashboardComponent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullDashboardComponent(2); 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* + +