upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:15:59 +00:00
parent 76683ff821
commit 41eeb54e2a
12 changed files with 81 additions and 180 deletions

View File

@ -40,10 +40,10 @@ use phpOMS\Utils\RnG\DateTime;
use phpOMS\Utils\TestUtils;
/**
* @testdox Modules\HumanResourceManagement\tests\Controller\ApiControllerTest: HumanResourceManagement api controller
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Controller\ApiController::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\HumanResourceManagement\tests\Controller\ApiControllerTest: HumanResourceManagement api controller')]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{
protected ApplicationAbstract $app;
@ -114,10 +114,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
TestUtils::setMember($this->module, 'app', $this->app);
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeFromAccountCreate() : void
{
$response = new HttpResponse();
@ -131,10 +128,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, self::$employee = $response->getDataArray('')['response'][0]->id);
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNewEmployeeCreate() : void
{
$response = new HttpResponse();
@ -147,10 +141,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, self::$employee = $response->getDataArray('')['response']->id);
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiEmployeeCreateInvalidData() : void
{
$response = new HttpResponse();
@ -163,10 +154,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeCreateFromAccountInvalidData() : void
{
$response = new HttpResponse();
@ -179,10 +167,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNewEmployeeCreateInvalidData() : void
{
$response = new HttpResponse();
@ -195,11 +180,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @depends testEmployeeFromAccountCreate
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Depends('testEmployeeFromAccountCreate')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeHistoryCreate() : void
{
$start = DateTime::generateDateTime(
@ -234,10 +216,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeHistoryCreateInvalidData() : void
{
$response = new HttpResponse();
@ -250,11 +229,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @depends testEmployeeFromAccountCreate
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Depends('testEmployeeFromAccountCreate')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeWorkHistoryCreate() : void
{
$start = DateTime::generateDateTime(
@ -294,10 +270,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeWorkHistoryCreateInvalidData() : void
{
$response = new HttpResponse();
@ -310,11 +283,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}
/**
* @depends testEmployeeFromAccountCreate
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Depends('testEmployeeFromAccountCreate')]
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeEducationHistoryCreate() : void
{
$start = DateTime::generateDateTime(
@ -355,10 +325,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @covers \Modules\HumanResourceManagement\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEmployeeEducationHistoryCreateInvalidData() : void
{
$response = new HttpResponse();

View File

@ -19,6 +19,7 @@ use Modules\HumanResourceManagement\Models\EmployeeEducationHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeEducationHistory::class)]
final class EmployeeEducationHistoryTest extends \PHPUnit\Framework\TestCase
{
private EmployeeEducationHistory $history;
@ -31,10 +32,7 @@ final class EmployeeEducationHistoryTest extends \PHPUnit\Framework\TestCase
$this->history = new EmployeeEducationHistory();
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeEducationHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->history->id);
@ -47,10 +45,7 @@ final class EmployeeEducationHistoryTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Stdlib\Base\Address', $this->history->address);
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeEducationHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->history->employee = 2;

View File

@ -22,12 +22,10 @@ use Modules\Profile\Models\ProfileMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeHistoryMapper::class)]
final class EmployeeHistoryMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeHistoryMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$employee = new Employee(ProfileMapper::get()->where('id', 1)->execute());

View File

@ -19,6 +19,7 @@ use Modules\HumanResourceManagement\Models\EmployeeHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeHistory::class)]
final class EmployeeHistoryTest extends \PHPUnit\Framework\TestCase
{
private EmployeeHistory $history;
@ -31,10 +32,7 @@ final class EmployeeHistoryTest extends \PHPUnit\Framework\TestCase
$this->history = new EmployeeHistory();
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->history->id);
@ -46,10 +44,7 @@ final class EmployeeHistoryTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\DateTime', $this->history->start);
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->history->employee = 2;

View File

@ -23,12 +23,10 @@ use Modules\Profile\Models\ProfileMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeMapper::class)]
final class EmployeeMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeMapper
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCR() : void
{
if (($profile = ProfileMapper::get()->where('account', 1)->execute())->id === 0) {

View File

@ -22,6 +22,7 @@ use Modules\HumanResourceManagement\Models\EmployeeWorkHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\Employee::class)]
final class EmployeeTest extends \PHPUnit\Framework\TestCase
{
private Employee $employee;
@ -34,10 +35,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
$this->employee = new Employee();
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->employee->id);
@ -50,10 +48,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->employee->getWorkHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testPrivateHashInputOutput() : void
{
$temp = $this->employee->getSemiPrivateHash();
@ -62,10 +57,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->employee->compareSemiPrivateHash($temp));
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testHistoryInputOutput() : void
{
$this->employee->addHistory($a = new EmployeeHistory());
@ -74,10 +66,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
self::assertEquals($b, $this->employee->getNewestHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testWorkHistoryInputOutput() : void
{
$this->employee->addWorkHistory($a = new EmployeeWorkHistory());
@ -86,10 +75,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
self::assertEquals($b, $this->employee->getNewestWorkHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testEducationHistoryInputOutput() : void
{
$this->employee->addEducationHistory($a = new EmployeeEducationHistory());
@ -98,10 +84,7 @@ final class EmployeeTest extends \PHPUnit\Framework\TestCase
self::assertEquals($b, $this->employee->getNewestEducationHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\Employee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$serialized = $this->employee->jsonSerialize();

View File

@ -19,6 +19,7 @@ use Modules\HumanResourceManagement\Models\EmployeeWorkHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeWorkHistory::class)]
final class EmployeeWorkHistoryTest extends \PHPUnit\Framework\TestCase
{
private EmployeeWorkHistory $history;
@ -31,10 +32,7 @@ final class EmployeeWorkHistoryTest extends \PHPUnit\Framework\TestCase
$this->history = new EmployeeWorkHistory();
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeWorkHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->history->id);
@ -45,10 +43,7 @@ final class EmployeeWorkHistoryTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Stdlib\Base\Address', $this->history->address);
}
/**
* @covers \Modules\HumanResourceManagement\Models\EmployeeWorkHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->history->employee = 2;

View File

@ -19,31 +19,23 @@ use Modules\HumanResourceManagement\Models\NullEmployeeEducationHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\NullEmployeeEducationHistory::class)]
final class NullEmployeeEducationHistoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeEducationHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\HumanResourceManagement\Models\EmployeeEducationHistory', new NullEmployeeEducationHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeEducationHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullEmployeeEducationHistory(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeEducationHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullEmployeeEducationHistory(2);

View File

@ -19,31 +19,23 @@ use Modules\HumanResourceManagement\Models\NullEmployeeHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\NullEmployeeHistory::class)]
final class NullEmployeeHistoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\HumanResourceManagement\Models\EmployeeHistory', new NullEmployeeHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullEmployeeHistory(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullEmployeeHistory(2);

View File

@ -19,31 +19,23 @@ use Modules\HumanResourceManagement\Models\NullEmployee;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\NullEmployee::class)]
final class NullEmployeeTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\HumanResourceManagement\Models\Employee', new NullEmployee());
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullEmployee(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployee
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullEmployee(2);

View File

@ -19,31 +19,23 @@ use Modules\HumanResourceManagement\Models\NullEmployeeWorkHistory;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\NullEmployeeWorkHistory::class)]
final class NullEmployeeWorkHistoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeWorkHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\HumanResourceManagement\Models\EmployeeWorkHistory', new NullEmployeeWorkHistory());
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeWorkHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullEmployeeWorkHistory(2);
self::assertEquals(2, $null->id);
}
/**
* @covers \Modules\HumanResourceManagement\Models\NullEmployeeWorkHistory
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullEmployeeWorkHistory(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>