From 580d82de1bb7e61b29873a4b9316984f9a92c47d 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 | 34 ++++---------- tests/Models/NullSessionElementTest.php | 16 ++----- tests/Models/NullSessionTest.php | 16 ++----- tests/Models/SessionElementMapperTest.php | 6 +-- tests/Models/SessionElementTest.php | 16 ++----- tests/Models/SessionMapperTest.php | 6 +-- tests/Models/SessionTest.php | 26 +++-------- tests/phpunit_default.xml | 56 ++++++++++++----------- 8 files changed, 59 insertions(+), 117 deletions(-) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 37aa7d0..2e42117 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -39,10 +39,10 @@ use phpOMS\Router\WebRouter; use phpOMS\Utils\TestUtils; /** - * @testdox Modules\HumanResourceTimeRecording\tests\Controller\ApiControllerTest: HumanResourceTimeRecording api controller - * * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Controller\ApiController::class)] +#[\PHPUnit\Framework\Attributes\TestDox('Modules\HumanResourceTimeRecording\tests\Controller\ApiControllerTest: HumanResourceTimeRecording api controller')] final class ApiControllerTest extends \PHPUnit\Framework\TestCase { protected ApplicationAbstract $app; @@ -99,10 +99,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase TestUtils::setMember($this->module, 'app', $this->app); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionCR() : void { if (($profile = ProfileMapper::get()->where('account', 1)->limit(1)->execute())->id === 0) { @@ -138,10 +135,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, $response->getDataArray('')['response']->id); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionCreateInvalidPermission() : void { $response = new HttpResponse(); @@ -154,10 +148,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_403, $response->header->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionCreateInvalidDataEmployee() : void { $response = new HttpResponse(); @@ -170,10 +161,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_403, $response->header->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionElementCreateInvalidData() : void { $response = new HttpResponse(); @@ -186,10 +174,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionElementCreateInvalidSessionId() : void { $response = new HttpResponse(); @@ -203,10 +188,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testApiSessionElementCreateInvalidPermission() : void { $response = new HttpResponse(); diff --git a/tests/Models/NullSessionElementTest.php b/tests/Models/NullSessionElementTest.php index 8672f51..ae3b170 100755 --- a/tests/Models/NullSessionElementTest.php +++ b/tests/Models/NullSessionElementTest.php @@ -19,31 +19,23 @@ use Modules\HumanResourceTimeRecording\Models\NullSessionElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\NullSessionElement::class)] final class NullSessionElementTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\HumanResourceTimeRecording\Models\SessionElement', new NullSessionElement()); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullSessionElement(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullSessionElement(2); diff --git a/tests/Models/NullSessionTest.php b/tests/Models/NullSessionTest.php index 0f6ca65..a91a512 100755 --- a/tests/Models/NullSessionTest.php +++ b/tests/Models/NullSessionTest.php @@ -19,31 +19,23 @@ use Modules\HumanResourceTimeRecording\Models\NullSession; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\NullSession::class)] final class NullSessionTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSession - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\HumanResourceTimeRecording\Models\Session', new NullSession()); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSession - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullSession(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\NullSession - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullSession(2); diff --git a/tests/Models/SessionElementMapperTest.php b/tests/Models/SessionElementMapperTest.php index 95a49a7..2c12ea4 100755 --- a/tests/Models/SessionElementMapperTest.php +++ b/tests/Models/SessionElementMapperTest.php @@ -22,12 +22,10 @@ use Modules\HumanResourceTimeRecording\Models\SessionElementMapper; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\SessionElementMapper::class)] final class SessionElementMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\HumanResourceTimeRecording\Models\SessionElementMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCRUD() : void { $element = new SessionElement(new Session(new NullAccount(1)), new \DateTime('now')); diff --git a/tests/Models/SessionElementTest.php b/tests/Models/SessionElementTest.php index db28f5f..2bb2f73 100755 --- a/tests/Models/SessionElementTest.php +++ b/tests/Models/SessionElementTest.php @@ -21,6 +21,7 @@ use Modules\HumanResourceTimeRecording\Models\SessionElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\SessionElement::class)] final class SessionElementTest extends \PHPUnit\Framework\TestCase { private SessionElement $element; @@ -33,10 +34,7 @@ final class SessionElementTest extends \PHPUnit\Framework\TestCase $this->element = new SessionElement(); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\SessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->element->id); @@ -45,20 +43,14 @@ final class SessionElementTest extends \PHPUnit\Framework\TestCase self::assertEquals(ClockingStatus::START, $this->element->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\SessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testStatusInputOutput() : void { $this->element->status = ClockingStatus::END; self::assertEquals(ClockingStatus::END, $this->element->status); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\SessionElement - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->element->session = new NullSession(2); diff --git a/tests/Models/SessionMapperTest.php b/tests/Models/SessionMapperTest.php index c105f80..218fab4 100755 --- a/tests/Models/SessionMapperTest.php +++ b/tests/Models/SessionMapperTest.php @@ -23,12 +23,10 @@ use Modules\HumanResourceTimeRecording\Models\SessionMapper; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\SessionMapper::class)] final class SessionMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\HumanResourceTimeRecording\Models\SessionMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCRUD() : void { $session = new Session(new NullAccount(1)); diff --git a/tests/Models/SessionTest.php b/tests/Models/SessionTest.php index cbd616d..f7638b1 100755 --- a/tests/Models/SessionTest.php +++ b/tests/Models/SessionTest.php @@ -22,6 +22,7 @@ use Modules\HumanResourceTimeRecording\Models\SessionElement; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceTimeRecording\Models\Session::class)] final class SessionTest extends \PHPUnit\Framework\TestCase { private Session $session; @@ -34,10 +35,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase $this->session = new Session(); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\Session - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->session->id); @@ -50,10 +48,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase self::assertNull($this->session->end); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\Session - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testStatusInputOutput() : void { $element = new SessionElement(null, new \DateTime('2021-10-05')); @@ -71,10 +66,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase self::assertEquals(ClockingStatus::CONTINUE, $this->session->getStatus()); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\Session - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testBusyBreakInputOutput() : void { $element = new SessionElement(null, new \DateTime('2021-10-05 02:00:00')); @@ -115,10 +107,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase self::assertEquals(7 * 60 * 60, $this->session->getBusy()); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\Session - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSessionElementInputOutput() : void { $element = new SessionElement(null, new \DateTime('now')); @@ -126,10 +115,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase self::assertCount(1, $this->session->getSessionElements()); } - /** - * @covers \Modules\HumanResourceTimeRecording\Models\Session - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->session->type = ClockingType::VACATION; 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* + +