upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:15:59 +00:00
parent 44379b3b22
commit 4364324a73
7 changed files with 55 additions and 105 deletions

View File

@ -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();

View File

@ -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';

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -1,31 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
<include>
<directory suffix=".php">../</directory>
</include>
<exclude>
<directory>../vendor*</directory>
<directory>../MainRepository*</directory>
<directory>../Karaka*</directory>
<directory>../Admin/Install/Application*</directory>
<directory>../phpOMS*</directory>
<directory>../tests*</directory>
<directory>../*/tests*</directory>
<directory>../**/tests*</directory>
<directory>*/tests*</directory>
<directory suffix="tpl.php">../*</directory>
<directory suffix="lang.php">../*</directory>
<directory suffix="Test.php">../*</directory>
<directory suffix="Routes.php">../*</directory>
<directory suffix="Hooks.php">../*</directory>
<directory>../**/test*</directory>
<directory>../**/Theme*</directory>
<directory>../**/Admin/Routes*</directory>
<directory>../**/Admin/Hooks*</directory>
<directory>../**/Admin/Install*</directory>
<directory>../Media/Files*</directory>
</exclude>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="coverage.xml"/>
<html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/>
@ -56,4 +31,31 @@
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
<const name="RESET" value="1"/>
</php>
<source>
<include>
<directory suffix=".php">../</directory>
</include>
<exclude>
<directory>../vendor*</directory>
<directory>../MainRepository*</directory>
<directory>../Karaka*</directory>
<directory>../Admin/Install/Application*</directory>
<directory>../phpOMS*</directory>
<directory>../tests*</directory>
<directory>../*/tests*</directory>
<directory>../**/tests*</directory>
<directory>*/tests*</directory>
<directory suffix="tpl.php">../*</directory>
<directory suffix="lang.php">../*</directory>
<directory suffix="Test.php">../*</directory>
<directory suffix="Routes.php">../*</directory>
<directory suffix="Hooks.php">../*</directory>
<directory>../**/test*</directory>
<directory>../**/Theme*</directory>
<directory>../**/Admin/Routes*</directory>
<directory>../**/Admin/Hooks*</directory>
<directory>../**/Admin/Install*</directory>
<directory>../Media/Files*</directory>
</exclude>
</source>
</phpunit>