upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:15:59 +00:00
parent c7c2cba0ff
commit f604371897
8 changed files with 114 additions and 254 deletions

View File

@ -34,10 +34,10 @@ use phpOMS\System\File\Local\Directory;
use phpOMS\Utils\TestUtils; use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\Helper\tests\Controller\ApiControllerTest: Helper api controller
*
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Controller\ApiController::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\Helper\tests\Controller\ApiControllerTest: Helper api controller')]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{ {
protected ApplicationAbstract $app; protected ApplicationAbstract $app;
@ -98,10 +98,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\Helper\Controller\ApiController
* @group module
*/
public function testStandaloneTemplateCreate() : void public function testStandaloneTemplateCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -145,10 +142,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
\rmdir(__DIR__ . '/temp'); \rmdir(__DIR__ . '/temp');
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testTemplateCreate() : void public function testTemplateCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -192,10 +186,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
\rmdir(__DIR__ . '/temp'); \rmdir(__DIR__ . '/temp');
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testTemplateCreateInvalidPermission() : void public function testTemplateCreateInvalidPermission() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -239,10 +230,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
Directory::delete(__DIR__ . '/temp'); Directory::delete(__DIR__ . '/temp');
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportPdf() : void public function testExportPdf() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -256,10 +244,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'pdf') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'pdf') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportXlsx() : void public function testExportXlsx() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -273,10 +258,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'xlsx') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'xlsx') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportDocx() : void public function testExportDocx() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -290,10 +272,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'docx') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'docx') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportPptx() : void public function testExportPptx() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -307,10 +286,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'pptx') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'pptx') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportCsv() : void public function testExportCsv() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -324,10 +300,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'csv') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'csv') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportJson() : void public function testExportJson() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -341,10 +314,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'json') !== false); self::assertTrue(\stripos($response->header->get('Content-disposition')[0] ?? '', 'json') !== false);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportInvalidPermission() : void public function testExportInvalidPermission() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -358,10 +328,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_403, $response->header->status); self::assertEquals(RequestStatusCode::R_403, $response->header->status);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportOtherType() : void public function testExportOtherType() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -375,10 +342,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_200, $response->header->status); // is html "export"/render self::assertEquals(RequestStatusCode::R_200, $response->header->status); // is html "export"/render
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportInvalidData() : void public function testExportInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -391,10 +355,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\Helper\Controller\ApiController
* @group module
*/
public function testApiTemplateCreateInvalidData() : void public function testApiTemplateCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -407,11 +368,8 @@ 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\Depends('testTemplateCreate')]
* @depends testTemplateCreate #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testReportCreate() : void public function testReportCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -438,10 +396,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiReportCreate($request, $response); $this->module->apiReportCreate($request, $response);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testExportOtherTypeNotStandalone() : void public function testExportOtherTypeNotStandalone() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -455,10 +410,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(RequestStatusCode::R_200, $response->header->status); // is html "export"/render self::assertEquals(RequestStatusCode::R_200, $response->header->status); // is html "export"/render
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testReportCreateInvalidPermission() : void public function testReportCreateInvalidPermission() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
@ -490,10 +442,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
} }
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Controller\ApiController
* @group module
*/
public function testApiReportCreateInvalidData() : void public function testApiReportCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();

View File

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

View File

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

View File

@ -24,10 +24,10 @@ use Modules\Media\Models\Collection;
use Modules\Media\Models\Media; use Modules\Media\Models\Media;
/** /**
* @testdox Modules\tests\Helper\Models\ReportMapperTest: Report database mapper
*
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\ReportMapper::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\tests\Helper\Models\ReportMapperTest: Report database mapper')]
final class ReportMapperTest extends \PHPUnit\Framework\TestCase final class ReportMapperTest extends \PHPUnit\Framework\TestCase
{ {
private function createTemplate() private function createTemplate()
@ -99,11 +99,8 @@ final class ReportMapperTest extends \PHPUnit\Framework\TestCase
return $template; return $template;
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The model can be created and read from the database #[\PHPUnit\Framework\Attributes\TestDox('The model can be created and read from the database')]
* @covers \Modules\Helper\Models\ReportMapper
* @group module
*/
public function testCR() : void public function testCR() : void
{ {
$report = new Report(); $report = new Report();

View File

@ -21,10 +21,10 @@ use Modules\Helper\Models\Report;
use Modules\Media\Models\NullCollection; use Modules\Media\Models\NullCollection;
/** /**
* @testdox Modules\tests\Helper\Models\ReportTest: Report model
*
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\Report::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\tests\Helper\Models\ReportTest: Report model')]
final class ReportTest extends \PHPUnit\Framework\TestCase final class ReportTest extends \PHPUnit\Framework\TestCase
{ {
protected Report $report; protected Report $report;
@ -37,11 +37,8 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
$this->report = new Report(); $this->report = new Report();
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The model has the expected default values after initialization #[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->report->id); self::assertEquals(0, $this->report->id);
@ -55,77 +52,56 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $this->report->source->id); self::assertEquals(0, $this->report->source->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The creator can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The creator can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testCreatedByInputOutput() : void public function testCreatedByInputOutput() : void
{ {
$this->report->createdBy = new NullAccount(1); $this->report->createdBy = new NullAccount(1);
self::assertEquals(1, $this->report->createdBy->id); self::assertEquals(1, $this->report->createdBy->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The title can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The title can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testTitleInputOutput() : void public function testTitleInputOutput() : void
{ {
$this->report->title = 'Title'; $this->report->title = 'Title';
self::assertEquals('Title', $this->report->title); self::assertEquals('Title', $this->report->title);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The description can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The description can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testDescriptionInputOutput() : void public function testDescriptionInputOutput() : void
{ {
$this->report->description = 'Description'; $this->report->description = 'Description';
self::assertEquals('Description', $this->report->description); self::assertEquals('Description', $this->report->description);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The raw description can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The raw description can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testDescriptionRawInputOutput() : void public function testDescriptionRawInputOutput() : void
{ {
$this->report->descriptionRaw = 'DescriptionRaw'; $this->report->descriptionRaw = 'DescriptionRaw';
self::assertEquals('DescriptionRaw', $this->report->descriptionRaw); self::assertEquals('DescriptionRaw', $this->report->descriptionRaw);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The template can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The template can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testTemplateInputOutput() : void public function testTemplateInputOutput() : void
{ {
$this->report->template = new NullTemplate(11); $this->report->template = new NullTemplate(11);
self::assertEquals(11, $this->report->template->id); self::assertEquals(11, $this->report->template->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The source can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The source can be set and returned correctly')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testSourceInputOutput() : void public function testSourceInputOutput() : void
{ {
$this->report->source = new NullCollection(4); $this->report->source = new NullCollection(4);
self::assertEquals(4, $this->report->source->id); self::assertEquals(4, $this->report->source->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox Report data can be turned into an array #[\PHPUnit\Framework\Attributes\TestDox('Report data can be turned into an array')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testToArray() : void public function testToArray() : void
{ {
$this->report->template = new NullTemplate(11); $this->report->template = new NullTemplate(11);
@ -151,11 +127,8 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
self::assertTrue(true); self::assertTrue(true);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox Report data can be json serialized #[\PHPUnit\Framework\Attributes\TestDox('Report data can be json serialized')]
* @covers \Modules\Helper\Models\Report
* @group module
*/
public function testJsonSerialize() : void public function testJsonSerialize() : void
{ {
$this->report->template = new NullTemplate(11); $this->report->template = new NullTemplate(11);

View File

@ -24,17 +24,14 @@ use Modules\Media\Models\Media;
use phpOMS\DataStorage\Database\Query\OrderType; use phpOMS\DataStorage\Database\Query\OrderType;
/** /**
* @testdox Modules\tests\Helper\Models\TemplateMapperTest: Template database mapper
*
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\TemplateMapper::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\tests\Helper\Models\TemplateMapperTest: Template database mapper')]
final class TemplateMapperTest extends \PHPUnit\Framework\TestCase final class TemplateMapperTest extends \PHPUnit\Framework\TestCase
{ {
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The model can be created and read from the database #[\PHPUnit\Framework\Attributes\TestDox('The model can be created and read from the database')]
* @covers \Modules\Helper\Models\TemplateMapper
* @group module
*/
public function testCR() : void public function testCR() : void
{ {
$template = new Template(); $template = new Template();
@ -118,11 +115,8 @@ final class TemplateMapperTest extends \PHPUnit\Framework\TestCase
self::assertEquals($template->getExpected(), $templateR->getExpected()); self::assertEquals($template->getExpected(), $templateR->getExpected());
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The newest model can be read from the database #[\PHPUnit\Framework\Attributes\TestDox('The newest model can be read from the database')]
* @covers \Modules\Helper\Models\TemplateMapper
* @group module
*/
public function testNewest() : void public function testNewest() : void
{ {
$newest = TemplateMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->execute(); $newest = TemplateMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->execute();

View File

@ -24,10 +24,10 @@ use Modules\Organization\Models\NullUnit;
use phpOMS\Utils\TestUtils; use phpOMS\Utils\TestUtils;
/** /**
* @testdox Modules\tests\Helper\Models\TemplateTest: Template model
*
* @internal * @internal
*/ */
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\Template::class)]
#[\PHPUnit\Framework\Attributes\TestDox('Modules\tests\Helper\Models\TemplateTest: Template model')]
final class TemplateTest extends \PHPUnit\Framework\TestCase final class TemplateTest extends \PHPUnit\Framework\TestCase
{ {
protected Template $template; protected Template $template;
@ -40,11 +40,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
$this->template = new Template(); $this->template = new Template();
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The model has the expected default values after initialization #[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->template->id); self::assertEquals(0, $this->template->id);
@ -62,77 +59,56 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf(NullReport::class, $this->template->getNewestReport()); self::assertInstanceOf(NullReport::class, $this->template->getNewestReport());
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The unit can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The unit can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testUnitInputOutput() : void public function testUnitInputOutput() : void
{ {
$this->template->unit = new NullUnit(1); $this->template->unit = new NullUnit(1);
self::assertEquals(1, $this->template->unit->id); self::assertEquals(1, $this->template->unit->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The creator can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The creator can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testCreatedByInputOutput() : void public function testCreatedByInputOutput() : void
{ {
$this->template->createdBy = new NullAccount(1); $this->template->createdBy = new NullAccount(1);
self::assertEquals(1, $this->template->createdBy->id); self::assertEquals(1, $this->template->createdBy->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The title can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The title can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testNameInputOutput() : void public function testNameInputOutput() : void
{ {
$this->template->name = 'Title'; $this->template->name = 'Title';
self::assertEquals('Title', $this->template->name); self::assertEquals('Title', $this->template->name);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The template can be set as standalone and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The template can be set as standalone and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testStandalonInputOutput() : void public function testStandalonInputOutput() : void
{ {
$this->template->isStandalone = true; $this->template->isStandalone = true;
self::assertTrue($this->template->isStandalone); self::assertTrue($this->template->isStandalone);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The description can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The description can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testDescriptionInputOutput() : void public function testDescriptionInputOutput() : void
{ {
$this->template->description = 'Description'; $this->template->description = 'Description';
self::assertEquals('Description', $this->template->description); self::assertEquals('Description', $this->template->description);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The raw description can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The raw description can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testDescriptionRawInputOutput() : void public function testDescriptionRawInputOutput() : void
{ {
$this->template->descriptionRaw = 'DescriptionRaw'; $this->template->descriptionRaw = 'DescriptionRaw';
self::assertEquals('DescriptionRaw', $this->template->descriptionRaw); self::assertEquals('DescriptionRaw', $this->template->descriptionRaw);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The expected report files can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The expected report files can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testExpectedInputOutput() : void public function testExpectedInputOutput() : void
{ {
$this->template->setExpected(['source1.csv', 'source2.csv']); $this->template->setExpected(['source1.csv', 'source2.csv']);
@ -140,32 +116,23 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
self::assertEquals(['source1.csv', 'source2.csv', 'source3.csv'], $this->template->getExpected()); self::assertEquals(['source1.csv', 'source2.csv', 'source3.csv'], $this->template->getExpected());
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The source can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The source can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testSourceInputOutput() : void public function testSourceInputOutput() : void
{ {
$this->template->source = new NullCollection(4); $this->template->source = new NullCollection(4);
self::assertEquals(4, $this->template->source->id); self::assertEquals(4, $this->template->source->id);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox The data storage type can be set and returned correctly #[\PHPUnit\Framework\Attributes\TestDox('The data storage type can be set and returned correctly')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testDatatypeInputOutput() : void public function testDatatypeInputOutput() : void
{ {
$this->template->setDatatype(TemplateDataType::GLOBAL_DB); $this->template->setDatatype(TemplateDataType::GLOBAL_DB);
self::assertEquals(TemplateDataType::GLOBAL_DB, $this->template->getDatatype()); self::assertEquals(TemplateDataType::GLOBAL_DB, $this->template->getDatatype());
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testNewestReportOutput() : void public function testNewestReportOutput() : void
{ {
TestUtils::setMember($this->template, 'reports', [ TestUtils::setMember($this->template, 'reports', [
@ -176,11 +143,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
self::assertEquals($b, $this->template->getNewestReport()); self::assertEquals($b, $this->template->getNewestReport());
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox Template data can be turned into an array #[\PHPUnit\Framework\Attributes\TestDox('Template data can be turned into an array')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testToArray() : void public function testToArray() : void
{ {
$this->template->name = 'testName'; $this->template->name = 'testName';
@ -208,11 +172,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
self::assertTrue(true); self::assertTrue(true);
} }
/** #[\PHPUnit\Framework\Attributes\Group('module')]
* @testdox Template data can be json serialized #[\PHPUnit\Framework\Attributes\TestDox('Template data can be json serialized')]
* @covers \Modules\Helper\Models\Template
* @group module
*/
public function testJsonSerialize() : void public function testJsonSerialize() : void
{ {
$this->template->name = 'testName'; $this->template->name = 'testName';

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>