upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:16:00 +00:00
parent 90f5220410
commit d6f57d92c1
11 changed files with 97 additions and 241 deletions

View File

@ -36,6 +36,7 @@ use phpOMS\Utils\TestUtils;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Controller\ApiController::class)]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{ {
protected $app = null; protected $app = null;
@ -86,10 +87,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
TestUtils::setMember($this->module, 'app', $this->app); TestUtils::setMember($this->module, 'app', $this->app);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitGet() : void public function testApiUnitGet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -104,10 +102,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id); self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitSet() : void public function testApiUnitSet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -123,10 +118,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('OMS', $response->getDataArray('')['response']->name); self::assertEquals('OMS', $response->getDataArray('')['response']->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitFind() : void public function testApiUnitFind() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -141,10 +133,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getData('')[0]->id); self::assertGreaterThan(0, $response->getData('')[0]->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitCreateDelete() : void public function testApiUnitCreateDelete() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -170,10 +159,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
*/ */
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitCreateInvalid() : void public function testApiUnitCreateInvalid() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -188,10 +174,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
protected static $departmentId = 0; protected static $departmentId = 0;
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentCreate() : void public function testApiDepartmentCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -211,10 +194,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::$departmentId = $response->getDataArray('')['response']->id; self::$departmentId = $response->getDataArray('')['response']->id;
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentFind() : void public function testApiDepartmentFind() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -229,10 +209,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getData('')[0]->id); self::assertGreaterThan(0, $response->getData('')[0]->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentCreateInvalid() : void public function testApiDepartmentCreateInvalid() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -245,10 +222,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status); self::assertEquals(RequestStatusCode::R_400, $response->header->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentGet() : void public function testApiDepartmentGet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -263,10 +237,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id); self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentSet() : void public function testApiDepartmentSet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -282,10 +253,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('Production', $response->getDataArray('')['response']->name); self::assertEquals('Production', $response->getDataArray('')['response']->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiDepartmentDelete() : void public function testApiDepartmentDelete() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -300,10 +268,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
protected static $positionId = 0; protected static $positionId = 0;
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionCreate() : void public function testApiPositionCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -321,10 +286,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::$positionId = $response->getDataArray('')['response']->id; self::$positionId = $response->getDataArray('')['response']->id;
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionFind() : void public function testApiPositionFind() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -339,10 +301,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getData('')[0]->id); self::assertGreaterThan(0, $response->getData('')[0]->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionCreateInvalid() : void public function testApiPositionCreateInvalid() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -355,10 +314,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_400, $response->header->status); self::assertEquals(RequestStatusCode::R_400, $response->header->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionGet() : void public function testApiPositionGet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -373,10 +329,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id); self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionSet() : void public function testApiPositionSet() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -392,10 +345,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('Test', $response->getDataArray('')['response']->name); self::assertEquals('Test', $response->getDataArray('')['response']->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiPositionDelete() : void public function testApiPositionDelete() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -408,10 +358,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $response->getDataArray('')['response']->id); self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitImageSet() : void public function testApiUnitImageSet() : void
{ {
\copy(__DIR__ . '/icon.png', __DIR__ . '/temp_icon.png'); \copy(__DIR__ . '/icon.png', __DIR__ . '/temp_icon.png');
@ -438,10 +385,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals('Organization Logo', $image->name); self::assertEquals('Organization Logo', $image->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Controller\ApiController
* @group module
*/
public function testApiUnitImageSetInvalid() : void public function testApiUnitImageSetInvalid() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();

View File

@ -22,12 +22,10 @@ use Modules\Organization\Models\NullUnit;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\DepartmentMapper::class)]
final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\DepartmentMapper
* @group module
*/
public function testCRUD() : void public function testCRUD() : void
{ {
$department = new Department(); $department = new Department();
@ -46,11 +44,11 @@ final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
} }
/** /**
* @group volume
* @slowThreshold 15000 * @slowThreshold 15000
* @group module
* @coversNothing
*/ */
#[\PHPUnit\Framework\Attributes\Group('volume')]
#[\PHPUnit\Framework\Attributes\Group('module')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testVolume() : void public function testVolume() : void
{ {
$first = 2; $first = 2;

View File

@ -22,6 +22,7 @@ use Modules\Organization\Models\Status;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\Department::class)]
final class DepartmentTest extends \PHPUnit\Framework\TestCase final class DepartmentTest extends \PHPUnit\Framework\TestCase
{ {
private Department $department; private Department $department;
@ -34,10 +35,7 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
$this->department = new Department(); $this->department = new Department();
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->department->id); self::assertEquals(0, $this->department->id);
@ -49,60 +47,42 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
self::assertEquals(Status::INACTIVE, $this->department->status); self::assertEquals(Status::INACTIVE, $this->department->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testNameInputOutput() : void public function testNameInputOutput() : void
{ {
$this->department->name = 'Name'; $this->department->name = 'Name';
self::assertEquals('Name', $this->department->name); self::assertEquals('Name', $this->department->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testDescriptionInputOutput() : void public function testDescriptionInputOutput() : void
{ {
$this->department->description = 'Description'; $this->department->description = 'Description';
self::assertEquals('Description', $this->department->description); self::assertEquals('Description', $this->department->description);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testDescriptionRawInputOutput() : void public function testDescriptionRawInputOutput() : void
{ {
$this->department->descriptionRaw = 'DescriptionRaw'; $this->department->descriptionRaw = 'DescriptionRaw';
self::assertEquals('DescriptionRaw', $this->department->descriptionRaw); self::assertEquals('DescriptionRaw', $this->department->descriptionRaw);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testParentInputOutput() : void public function testParentInputOutput() : void
{ {
$this->department->parent = new NullDepartment(1); $this->department->parent = new NullDepartment(1);
self::assertEquals(1, $this->department->parent->id); self::assertEquals(1, $this->department->parent->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testUnitInputOutput() : void public function testUnitInputOutput() : void
{ {
$this->department->unit = new NullUnit(1); $this->department->unit = new NullUnit(1);
self::assertEquals(1, $this->department->unit->id); self::assertEquals(1, $this->department->unit->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Department
* @group module
*/
public function testSerialize() : void public function testSerialize() : void
{ {
$this->department->name = 'Name'; $this->department->name = 'Name';

View File

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

View File

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

View File

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

View File

@ -21,12 +21,10 @@ use Modules\Organization\Models\PositionMapper;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\PositionMapper::class)]
final class PositionMapperTest extends \PHPUnit\Framework\TestCase final class PositionMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\PositionMapper
* @group module
*/
public function testCRUD() : void public function testCRUD() : void
{ {
$position = new Position(); $position = new Position();
@ -43,11 +41,11 @@ final class PositionMapperTest extends \PHPUnit\Framework\TestCase
} }
/** /**
* @group volume
* @slowThreshold 15000 * @slowThreshold 15000
* @group module
* @coversNothing
*/ */
#[\PHPUnit\Framework\Attributes\Group('volume')]
#[\PHPUnit\Framework\Attributes\Group('module')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testVolume() : void public function testVolume() : void
{ {
$first = 2; $first = 2;

View File

@ -22,6 +22,7 @@ use Modules\Organization\Models\Status;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\Position::class)]
final class PositionTest extends \PHPUnit\Framework\TestCase final class PositionTest extends \PHPUnit\Framework\TestCase
{ {
private Position $position; private Position $position;
@ -34,10 +35,7 @@ final class PositionTest extends \PHPUnit\Framework\TestCase
$this->position = new Position(); $this->position = new Position();
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->position->id); self::assertEquals(0, $this->position->id);
@ -49,60 +47,42 @@ final class PositionTest extends \PHPUnit\Framework\TestCase
self::assertEquals(Status::INACTIVE, $this->position->status); self::assertEquals(Status::INACTIVE, $this->position->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testNameInputOutput() : void public function testNameInputOutput() : void
{ {
$this->position->name = 'Name'; $this->position->name = 'Name';
self::assertEquals('Name', $this->position->name); self::assertEquals('Name', $this->position->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testDescriptionInputOutput() : void public function testDescriptionInputOutput() : void
{ {
$this->position->description = 'Description'; $this->position->description = 'Description';
self::assertEquals('Description', $this->position->description); self::assertEquals('Description', $this->position->description);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testDescriptionRawInputOutput() : void public function testDescriptionRawInputOutput() : void
{ {
$this->position->descriptionRaw = 'DescriptionRaw'; $this->position->descriptionRaw = 'DescriptionRaw';
self::assertEquals('DescriptionRaw', $this->position->descriptionRaw); self::assertEquals('DescriptionRaw', $this->position->descriptionRaw);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testParentInputOutput() : void public function testParentInputOutput() : void
{ {
$this->position->parent = new NullPosition(1); $this->position->parent = new NullPosition(1);
self::assertEquals(1, $this->position->parent->id); self::assertEquals(1, $this->position->parent->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testDepartmentInputOutput() : void public function testDepartmentInputOutput() : void
{ {
$this->position->department = new NullDepartment(1); $this->position->department = new NullDepartment(1);
self::assertEquals(1, $this->position->department->id); self::assertEquals(1, $this->position->department->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Position
* @group module
*/
public function testSerialize() : void public function testSerialize() : void
{ {
$this->position->name = 'Name'; $this->position->name = 'Name';

View File

@ -21,12 +21,10 @@ use Modules\Organization\Models\UnitMapper;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\UnitMapper::class)]
final class UnitMapperTest extends \PHPUnit\Framework\TestCase final class UnitMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\UnitMapper
* @group module
*/
public function testCRUD() : void public function testCRUD() : void
{ {
$unit = new Unit(); $unit = new Unit();

View File

@ -22,6 +22,7 @@ use Modules\Organization\Models\Unit;
/** /**
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Organization\Models\Unit::class)]
final class UnitTest extends \PHPUnit\Framework\TestCase final class UnitTest extends \PHPUnit\Framework\TestCase
{ {
private Unit $unit; private Unit $unit;
@ -34,10 +35,7 @@ final class UnitTest extends \PHPUnit\Framework\TestCase
$this->unit = new Unit(); $this->unit = new Unit();
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->unit->id); self::assertEquals(0, $this->unit->id);
@ -49,60 +47,42 @@ final class UnitTest extends \PHPUnit\Framework\TestCase
self::assertEquals(Status::INACTIVE, $this->unit->status); self::assertEquals(Status::INACTIVE, $this->unit->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testNameInputOutput() : void public function testNameInputOutput() : void
{ {
$this->unit->name = 'Name'; $this->unit->name = 'Name';
self::assertEquals('Name', $this->unit->name); self::assertEquals('Name', $this->unit->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testDescriptionInputOutput() : void public function testDescriptionInputOutput() : void
{ {
$this->unit->description = 'Description'; $this->unit->description = 'Description';
self::assertEquals('Description', $this->unit->description); self::assertEquals('Description', $this->unit->description);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testDescriptionRawInputOutput() : void public function testDescriptionRawInputOutput() : void
{ {
$this->unit->descriptionRaw = 'DescriptionRaw'; $this->unit->descriptionRaw = 'DescriptionRaw';
self::assertEquals('DescriptionRaw', $this->unit->descriptionRaw); self::assertEquals('DescriptionRaw', $this->unit->descriptionRaw);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testParentInputOutput() : void public function testParentInputOutput() : void
{ {
$this->unit->parent = new NullUnit(1); $this->unit->parent = new NullUnit(1);
self::assertEquals(1, $this->unit->parent->id); self::assertEquals(1, $this->unit->parent->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testImageInputOutput() : void public function testImageInputOutput() : void
{ {
$this->unit->image = new NullMedia(1); $this->unit->image = new NullMedia(1);
self::assertEquals(1, $this->unit->image->id); self::assertEquals(1, $this->unit->image->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Organization\Models\Unit
* @group module
*/
public function testSerialize() : void public function testSerialize() : void
{ {
$this->unit->name = 'Name'; $this->unit->name = 'Name';

View File

@ -1,31 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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" processUncoveredFiles="false"> <coverage includeUncoveredFiles="true">
<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>
<report> <report>
<clover outputFile="coverage.xml"/> <clover outputFile="coverage.xml"/>
<html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/> <html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/>
@ -56,4 +31,31 @@
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/> <const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
<const name="RESET" value="1"/> <const name="RESET" value="1"/>
</php> </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> </phpunit>