From 4364324a73f428e92da15e7a8f081d3e6394098d 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/ExchangeLogTest.php | 16 ++----- tests/Models/InterfaceManagerTest.php | 6 +-- tests/Models/NullExchangeLogTest.php | 16 ++----- tests/Models/NullExchangeSettingTest.php | 16 ++----- tests/Models/NullInterfaceManagerTest.php | 16 ++----- tests/phpunit_default.xml | 56 ++++++++++++----------- 7 files changed, 55 insertions(+), 105 deletions(-) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 080ec19..034a53d 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -34,10 +34,10 @@ use phpOMS\System\File\Local\Directory; use phpOMS\Utils\TestUtils; /** - * @testdox Modules\Exchange\tests\Controller\ApiControllerTest: Exchange api controller - * * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Controller\ApiController::class)] +#[\PHPUnit\Framework\Attributes\TestDox('Modules\Exchange\tests\Controller\ApiControllerTest: Exchange api controller')] final class ApiControllerTest extends \PHPUnit\Framework\TestCase { protected ApplicationAbstract $app; @@ -92,10 +92,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase TestUtils::setMember($this->module, 'app', $this->app); } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testInterfaceInstall() : void { $exchanges = \scandir(__DIR__ . '/../Interfaces'); @@ -176,10 +173,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase } } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testInterfaceInstallInvalidData() : void { $response = new HttpResponse(); @@ -192,10 +186,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testExport() : void { $response = new HttpResponse(); @@ -209,10 +200,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertTrue(\strlen($response->getData('')) > 500); } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testExportInvalidInterface() : void { $response = new HttpResponse(); @@ -226,10 +214,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertEquals(RequestStatusCode::R_400, $response->header->status); } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testLanguageImport() : void { $response = new HttpResponse(); @@ -260,10 +245,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase ); } - /** - * @covers \Modules\Exchange\Controller\ApiController - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testImportInvalidInterface() : void { $response = new HttpResponse(); diff --git a/tests/Models/ExchangeLogTest.php b/tests/Models/ExchangeLogTest.php index fa8f429..6c80b5e 100755 --- a/tests/Models/ExchangeLogTest.php +++ b/tests/Models/ExchangeLogTest.php @@ -20,6 +20,7 @@ use Modules\Exchange\Models\ExchangeType; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Models\ExchangeLog::class)] final class ExchangeLogTest extends \PHPUnit\Framework\TestCase { private ExchangeLog $log; @@ -32,10 +33,7 @@ final class ExchangeLogTest extends \PHPUnit\Framework\TestCase $this->log = new ExchangeLog(); } - /** - * @covers \Modules\Exchange\Models\ExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->log->id); @@ -47,10 +45,7 @@ final class ExchangeLogTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\DateTimeImmutable', $this->log->createdAt); } - /** - * @covers \Modules\Exchange\Models\ExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testFieldsInputOutput() : void { $this->log->setFields($fields = [ @@ -60,10 +55,7 @@ final class ExchangeLogTest extends \PHPUnit\Framework\TestCase self::assertEquals($fields, $this->log->getFields()); } - /** - * @covers \Modules\Exchange\Models\ExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->log->message = '123456'; diff --git a/tests/Models/InterfaceManagerTest.php b/tests/Models/InterfaceManagerTest.php index 0294b2d..224adbd 100755 --- a/tests/Models/InterfaceManagerTest.php +++ b/tests/Models/InterfaceManagerTest.php @@ -19,6 +19,7 @@ use Modules\Exchange\Models\InterfaceManager; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Models\InterfaceManager::class)] final class InterfaceManagerTest extends \PHPUnit\Framework\TestCase { private InterfaceManager $interface; @@ -31,10 +32,7 @@ final class InterfaceManagerTest extends \PHPUnit\Framework\TestCase $this->interface = new InterfaceManager(); } - /** - * @covers \Modules\Exchange\Models\InterfaceManager - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->interface->id); diff --git a/tests/Models/NullExchangeLogTest.php b/tests/Models/NullExchangeLogTest.php index 4c981e3..89f4558 100755 --- a/tests/Models/NullExchangeLogTest.php +++ b/tests/Models/NullExchangeLogTest.php @@ -19,31 +19,23 @@ use Modules\Exchange\Models\NullExchangeLog; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Models\NullExchangeLog::class)] final class NullExchangeLogTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Exchange\Models\NullExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Exchange\Models\ExchangeLog', new NullExchangeLog()); } - /** - * @covers \Modules\Exchange\Models\NullExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullExchangeLog(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Exchange\Models\NullExchangeLog - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullExchangeLog(2); diff --git a/tests/Models/NullExchangeSettingTest.php b/tests/Models/NullExchangeSettingTest.php index eda08a9..0c85dee 100644 --- a/tests/Models/NullExchangeSettingTest.php +++ b/tests/Models/NullExchangeSettingTest.php @@ -19,31 +19,23 @@ use Modules\Exchange\Models\NullExchangeSetting; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Models\NullExchangeSetting::class)] final class NullExchangeSettingTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Exchange\Models\NullExchangeSetting - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Exchange\Models\ExchangeSetting', new NullExchangeSetting()); } - /** - * @covers \Modules\Exchange\Models\NullExchangeSetting - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullExchangeSetting(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Exchange\Models\NullExchangeSetting - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullExchangeSetting(2); diff --git a/tests/Models/NullInterfaceManagerTest.php b/tests/Models/NullInterfaceManagerTest.php index 9e1adff..0c26bfe 100755 --- a/tests/Models/NullInterfaceManagerTest.php +++ b/tests/Models/NullInterfaceManagerTest.php @@ -19,31 +19,23 @@ use Modules\Exchange\Models\NullInterfaceManager; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Exchange\Models\NullInterfaceManager::class)] final class NullInterfaceManagerTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Exchange\Models\NullInterfaceManager - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Exchange\Models\InterfaceManager', new NullInterfaceManager()); } - /** - * @covers \Modules\Exchange\Models\NullInterfaceManager - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullInterfaceManager(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Exchange\Models\NullInterfaceManager - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullInterfaceManager(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* + +