mirror of
https://github.com/Karaka-Management/oms-Script.git
synced 2026-01-11 12:28:41 +00:00
upgrade phpunit
This commit is contained in:
parent
c7c2cba0ff
commit
f604371897
|
|
@ -34,10 +34,10 @@ use phpOMS\System\File\Local\Directory;
|
|||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\Helper\tests\Controller\ApiControllerTest: Helper api controller
|
||||
*
|
||||
* @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
|
||||
{
|
||||
protected ApplicationAbstract $app;
|
||||
|
|
@ -98,10 +98,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
TestUtils::setMember($this->module, 'app', $this->app);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testStandaloneTemplateCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -145,10 +142,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
\rmdir(__DIR__ . '/temp');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testTemplateCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -192,10 +186,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
\rmdir(__DIR__ . '/temp');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testTemplateCreateInvalidPermission() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -239,10 +230,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
Directory::delete(__DIR__ . '/temp');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportPdf() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportXlsx() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportDocx() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportPptx() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportCsv() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportJson() : void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportInvalidPermission() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -358,10 +328,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(RequestStatusCode::R_403, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportOtherType() : void
|
||||
{
|
||||
$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
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -391,10 +355,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testApiTemplateCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -407,11 +368,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testTemplateCreate
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Depends('testTemplateCreate')]
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testReportCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -438,10 +396,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$this->module->apiReportCreate($request, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testExportOtherTypeNotStandalone() : void
|
||||
{
|
||||
$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
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testReportCreateInvalidPermission() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -490,10 +442,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testApiReportCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
|
|||
|
|
@ -19,31 +19,23 @@ use Modules\Helper\Models\NullReport;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\NullReport::class)]
|
||||
final class NullReportTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullReport
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\Helper\Models\Report', new NullReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullReport
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullReport(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullReport
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$null = new NullReport(2);
|
||||
|
|
|
|||
|
|
@ -19,31 +19,23 @@ use Modules\Helper\Models\NullTemplate;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Helper\Models\NullTemplate::class)]
|
||||
final class NullTemplateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullTemplate
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\Helper\Models\Template', new NullTemplate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullTemplate
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullTemplate(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\NullTemplate
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$null = new NullTemplate(2);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ use Modules\Media\Models\Collection;
|
|||
use Modules\Media\Models\Media;
|
||||
|
||||
/**
|
||||
* @testdox Modules\tests\Helper\Models\ReportMapperTest: Report database mapper
|
||||
*
|
||||
* @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
|
||||
{
|
||||
private function createTemplate()
|
||||
|
|
@ -99,11 +99,8 @@ final class ReportMapperTest extends \PHPUnit\Framework\TestCase
|
|||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The model can be created and read from the database
|
||||
* @covers \Modules\Helper\Models\ReportMapper
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model can be created and read from the database')]
|
||||
public function testCR() : void
|
||||
{
|
||||
$report = new Report();
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ use Modules\Helper\Models\Report;
|
|||
use Modules\Media\Models\NullCollection;
|
||||
|
||||
/**
|
||||
* @testdox Modules\tests\Helper\Models\ReportTest: Report model
|
||||
*
|
||||
* @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
|
||||
{
|
||||
protected Report $report;
|
||||
|
|
@ -37,11 +37,8 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
|
|||
$this->report = new Report();
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The model has the expected default values after initialization
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')]
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->report->id);
|
||||
|
|
@ -55,77 +52,56 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0, $this->report->source->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The creator can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The creator can be set and returned correctly')]
|
||||
public function testCreatedByInputOutput() : void
|
||||
{
|
||||
$this->report->createdBy = new NullAccount(1);
|
||||
self::assertEquals(1, $this->report->createdBy->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The title can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The title can be set and returned correctly')]
|
||||
public function testTitleInputOutput() : void
|
||||
{
|
||||
$this->report->title = 'Title';
|
||||
self::assertEquals('Title', $this->report->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The description can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The description can be set and returned correctly')]
|
||||
public function testDescriptionInputOutput() : void
|
||||
{
|
||||
$this->report->description = 'Description';
|
||||
self::assertEquals('Description', $this->report->description);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The raw description can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The raw description can be set and returned correctly')]
|
||||
public function testDescriptionRawInputOutput() : void
|
||||
{
|
||||
$this->report->descriptionRaw = 'DescriptionRaw';
|
||||
self::assertEquals('DescriptionRaw', $this->report->descriptionRaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The template can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The template can be set and returned correctly')]
|
||||
public function testTemplateInputOutput() : void
|
||||
{
|
||||
$this->report->template = new NullTemplate(11);
|
||||
self::assertEquals(11, $this->report->template->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The source can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The source can be set and returned correctly')]
|
||||
public function testSourceInputOutput() : void
|
||||
{
|
||||
$this->report->source = new NullCollection(4);
|
||||
self::assertEquals(4, $this->report->source->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Report data can be turned into an array
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Report data can be turned into an array')]
|
||||
public function testToArray() : void
|
||||
{
|
||||
$this->report->template = new NullTemplate(11);
|
||||
|
|
@ -151,11 +127,8 @@ final class ReportTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Report data can be json serialized
|
||||
* @covers \Modules\Helper\Models\Report
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Report data can be json serialized')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$this->report->template = new NullTemplate(11);
|
||||
|
|
|
|||
|
|
@ -24,17 +24,14 @@ use Modules\Media\Models\Media;
|
|||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
|
||||
/**
|
||||
* @testdox Modules\tests\Helper\Models\TemplateMapperTest: Template database mapper
|
||||
*
|
||||
* @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
|
||||
{
|
||||
/**
|
||||
* @testdox The model can be created and read from the database
|
||||
* @covers \Modules\Helper\Models\TemplateMapper
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model can be created and read from the database')]
|
||||
public function testCR() : void
|
||||
{
|
||||
$template = new Template();
|
||||
|
|
@ -118,11 +115,8 @@ final class TemplateMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($template->getExpected(), $templateR->getExpected());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The newest model can be read from the database
|
||||
* @covers \Modules\Helper\Models\TemplateMapper
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The newest model can be read from the database')]
|
||||
public function testNewest() : void
|
||||
{
|
||||
$newest = TemplateMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->execute();
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ use Modules\Organization\Models\NullUnit;
|
|||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\tests\Helper\Models\TemplateTest: Template model
|
||||
*
|
||||
* @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
|
||||
{
|
||||
protected Template $template;
|
||||
|
|
@ -40,11 +40,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
|
|||
$this->template = new Template();
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The model has the expected default values after initialization
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')]
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->template->id);
|
||||
|
|
@ -62,77 +59,56 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf(NullReport::class, $this->template->getNewestReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The unit can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The unit can be set and returned correctly')]
|
||||
public function testUnitInputOutput() : void
|
||||
{
|
||||
$this->template->unit = new NullUnit(1);
|
||||
self::assertEquals(1, $this->template->unit->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The creator can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The creator can be set and returned correctly')]
|
||||
public function testCreatedByInputOutput() : void
|
||||
{
|
||||
$this->template->createdBy = new NullAccount(1);
|
||||
self::assertEquals(1, $this->template->createdBy->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The title can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The title can be set and returned correctly')]
|
||||
public function testNameInputOutput() : void
|
||||
{
|
||||
$this->template->name = 'Title';
|
||||
self::assertEquals('Title', $this->template->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The template can be set as standalone and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The template can be set as standalone and returned correctly')]
|
||||
public function testStandalonInputOutput() : void
|
||||
{
|
||||
$this->template->isStandalone = true;
|
||||
self::assertTrue($this->template->isStandalone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The description can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The description can be set and returned correctly')]
|
||||
public function testDescriptionInputOutput() : void
|
||||
{
|
||||
$this->template->description = 'Description';
|
||||
self::assertEquals('Description', $this->template->description);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The raw description can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The raw description can be set and returned correctly')]
|
||||
public function testDescriptionRawInputOutput() : void
|
||||
{
|
||||
$this->template->descriptionRaw = 'DescriptionRaw';
|
||||
self::assertEquals('DescriptionRaw', $this->template->descriptionRaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The expected report files can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The expected report files can be set and returned correctly')]
|
||||
public function testExpectedInputOutput() : void
|
||||
{
|
||||
$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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The source can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The source can be set and returned correctly')]
|
||||
public function testSourceInputOutput() : void
|
||||
{
|
||||
$this->template->source = new NullCollection(4);
|
||||
self::assertEquals(4, $this->template->source->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The data storage type can be set and returned correctly
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The data storage type can be set and returned correctly')]
|
||||
public function testDatatypeInputOutput() : void
|
||||
{
|
||||
$this->template->setDatatype(TemplateDataType::GLOBAL_DB);
|
||||
self::assertEquals(TemplateDataType::GLOBAL_DB, $this->template->getDatatype());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNewestReportOutput() : void
|
||||
{
|
||||
TestUtils::setMember($this->template, 'reports', [
|
||||
|
|
@ -176,11 +143,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($b, $this->template->getNewestReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Template data can be turned into an array
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Template data can be turned into an array')]
|
||||
public function testToArray() : void
|
||||
{
|
||||
$this->template->name = 'testName';
|
||||
|
|
@ -208,11 +172,8 @@ final class TemplateTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Template data can be json serialized
|
||||
* @covers \Modules\Helper\Models\Template
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Template data can be json serialized')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$this->template->name = 'testName';
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user