autofixes

This commit is contained in:
Dennis Eichhorn 2020-11-24 18:44:22 +01:00
parent ad4a17b43a
commit def9c22a75
7 changed files with 34 additions and 36 deletions

View File

@ -370,9 +370,9 @@ final class ApiController extends Controller
{
$expected = $request->getData('expected');
$helperTemplate = new Template();
$helperTemplate->name = $request->getData('name') ?? 'Empty';
$helperTemplate->description = Markdown::parse((string) ($request->getData('description') ?? ''));
$helperTemplate = new Template();
$helperTemplate->name = $request->getData('name') ?? 'Empty';
$helperTemplate->description = Markdown::parse((string) ($request->getData('description') ?? ''));
$helperTemplate->descriptionRaw = (string) ($request->getData('description') ?? '');
if ($collectionId > 0) {
@ -479,7 +479,7 @@ final class ApiController extends Controller
*/
private function createReportFromRequest(RequestAbstract $request, ResponseAbstract $response, int $collectionId) : Report
{
$helperReport = new Report();
$helperReport = new Report();
$helperReport->title = (string) ($request->getData('name'));
$helperReport->setSource(new NullCollection($collectionId));
$helperReport->setTemplate(new NullTemplate((int) $request->getData('template')));

View File

@ -27,8 +27,6 @@ use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Utils\StringUtils;
use phpOMS\Views\View;
use Modules\Admin\Models\Account;
use Modules\Media\Models\Collection;
/**
* Helper controller class.

View File

@ -38,19 +38,19 @@ final class TemplateMapper extends DataMapperAbstract
* @since 1.0.0
*/
protected static array $columns = [
'helper_template_id' => ['name' => 'helper_template_id', 'type' => 'int', 'internal' => 'id'],
'helper_template_status' => ['name' => 'helper_template_status', 'type' => 'int', 'internal' => 'status'],
'helper_template_title' => ['name' => 'helper_template_title', 'type' => 'string', 'internal' => 'name'],
'helper_template_data' => ['name' => 'helper_template_data', 'type' => 'int', 'internal' => 'datatype'],
'helper_template_standalone' => ['name' => 'helper_template_standalone', 'type' => 'bool', 'internal' => 'isStandalone'],
'helper_template_expected' => ['name' => 'helper_template_expected', 'type' => 'Json', 'internal' => 'expected'],
'helper_template_desc' => ['name' => 'helper_template_desc', 'type' => 'string', 'internal' => 'description'],
'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'],
'helper_template_id' => ['name' => 'helper_template_id', 'type' => 'int', 'internal' => 'id'],
'helper_template_status' => ['name' => 'helper_template_status', 'type' => 'int', 'internal' => 'status'],
'helper_template_title' => ['name' => 'helper_template_title', 'type' => 'string', 'internal' => 'name'],
'helper_template_data' => ['name' => 'helper_template_data', 'type' => 'int', 'internal' => 'datatype'],
'helper_template_standalone' => ['name' => 'helper_template_standalone', 'type' => 'bool', 'internal' => 'isStandalone'],
'helper_template_expected' => ['name' => 'helper_template_expected', 'type' => 'Json', 'internal' => 'expected'],
'helper_template_desc' => ['name' => 'helper_template_desc', 'type' => 'string', 'internal' => 'description'],
'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'],
'helper_template_virtual' => ['name' => 'helper_template_virtual', 'type' => 'string', 'internal' => 'virtualPath'],
'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy'],
'helper_template_unit' => ['name' => 'helper_template_unit', 'type' => 'int', 'internal' => 'unit'],
'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy'],
'helper_template_unit' => ['name' => 'helper_template_unit', 'type' => 'int', 'internal' => 'unit'],
'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
];
/**

View File

@ -35,14 +35,14 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase
$template = new Template();
$template->createdBy = new NullAccount(1);
$template->name = 'Report Template';
$template->name = 'Report Template';
$template->setStatus(HelperStatus::ACTIVE);
$template->description = 'Description';
$template->setDatatype(TemplateDataType::OTHER);
$template->setStandalone(false);
$template->setExpected(['source1.csv', 'source2.csv']);
$collection = new Collection();
$collection = new Collection();
$collection->createdBy = new NullAccount(1);
$templateFiles = [
@ -84,7 +84,7 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase
];
foreach ($templateFiles as $file) {
$media = new Media();
$media = new Media();
$media->createdBy = new NullAccount(1);
$media->extension = $file['extension'];
$media->setPath(\trim($file['path'], '/') . '/' . $file['filename']);
@ -109,12 +109,12 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase
$report = new Report();
$report->createdBy = new NullAccount(1);
$report->title = 'Title';
$report->title = 'Title';
$report->setStatus(HelperStatus::ACTIVE);
$report->description = 'Description';
$report->setTemplate($this->createTemplate());
$collection = new Collection();
$collection = new Collection();
$collection->createdBy = new NullAccount(1);
$reportFiles = [
@ -156,7 +156,7 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase
];
foreach ($reportFiles as $file) {
$media = new Media();
$media = new Media();
$media->createdBy = new NullAccount(1);
$media->extension = $file['extension'];
$media->setPath(\trim($file['path'], '/') . '/' . $file['filename']);

View File

@ -137,8 +137,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase
public function testToArray() : void
{
$this->report->setTemplate(new NullTemplate(11));
$this->report->title = 'testTitle';
$this->report->description = 'testDescription';
$this->report->title = 'testTitle';
$this->report->description = 'testDescription';
$this->report->descriptionRaw = 'testDescriptionRaw';
$array = $this->report->toArray();
@ -167,8 +167,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase
public function testJsonSerialize() : void
{
$this->report->setTemplate(new NullTemplate(11));
$this->report->title = 'testTitle';
$this->report->description = 'testDescription';
$this->report->title = 'testTitle';
$this->report->description = 'testDescription';
$this->report->descriptionRaw = 'testDescriptionRaw';
$array = $this->report->jsonSerialize();

View File

@ -39,15 +39,15 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase
$template = new Template();
$template->createdBy = new NullAccount(1);
$template->name = 'Title';
$template->name = 'Title';
$template->setStatus(HelperStatus::ACTIVE);
$template->description = 'Description';
$template->description = 'Description';
$template->descriptionRaw = 'DescriptionRaw';
$template->setDatatype(TemplateDataType::OTHER);
$template->setStandalone(false);
$template->setExpected(['source1.csv', 'source2.csv']);
$collection = new Collection();
$collection = new Collection();
$collection->createdBy = new NullAccount(1);
$templateFiles = [
@ -89,7 +89,7 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase
];
foreach ($templateFiles as $file) {
$media = new Media();
$media = new Media();
$media->createdBy = new NullAccount(1);
$media->extension = $file['extension'];
$media->setPath(\trim($file['path'], '/') . '/' . $file['filename']);

View File

@ -176,8 +176,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase
*/
public function testToArray() : void
{
$this->template->name = 'testName';
$this->template->description = 'testDescription';
$this->template->name = 'testName';
$this->template->description = 'testDescription';
$this->template->descriptionRaw = 'testDescriptionRaw';
$this->template->setStandalone(true);
@ -208,8 +208,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase
*/
public function testJsonSerialize() : void
{
$this->template->name = 'testName';
$this->template->description = 'testDescription';
$this->template->name = 'testName';
$this->template->description = 'testDescription';
$this->template->descriptionRaw = 'testDescriptionRaw';
$this->template->setStandalone(true);