mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-02-15 19:58:40 +00:00
phpstan, phpcs, phpunit fixes
This commit is contained in:
parent
86fd042589
commit
000bd7fa11
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace Modules\ItemManagement\Admin;
|
namespace Modules\ItemManagement\Admin;
|
||||||
|
|
||||||
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
|
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
|
||||||
|
use Modules\ItemManagement\Models\ItemAttributeValue;
|
||||||
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
|
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
use phpOMS\Config\SettingsInterface;
|
use phpOMS\Config\SettingsInterface;
|
||||||
|
|
@ -83,7 +84,7 @@ final class Installer extends InstallerAbstract
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = \json_decode($fileContent, true);
|
$items = \json_decode($fileContent, true);
|
||||||
$itemArray = self::createItems($app, $items);
|
$itemArray = self::createItems($app, $items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,8 +105,11 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var \Modules\ItemManagement\Controller\ApiController $module */
|
/** @var \Modules\ItemManagement\Controller\ApiController $module */
|
||||||
$module = $app->moduleManager->getModuleInstance('ItemManagement');
|
$module = $app->moduleManager->getModuleInstance('ItemManagement');
|
||||||
|
|
||||||
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
|
/** @var \Modules\ItemManagement\Models\ItemAttributeType[] $attributeTypes */
|
||||||
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();
|
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
|
||||||
|
|
||||||
|
/** @var \Modules\ItemManagement\Models\ItemL11nType[] $l11nTypes */
|
||||||
|
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();
|
||||||
|
|
||||||
// Change indexing for easier search later on.
|
// Change indexing for easier search later on.
|
||||||
foreach ($attributeTypes as $e) {
|
foreach ($attributeTypes as $e) {
|
||||||
|
|
@ -170,7 +174,17 @@ final class Installer extends InstallerAbstract
|
||||||
return $itemArray;
|
return $itemArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function findAttributeIdByValue(array $defaultValues, mixed $value)
|
/**
|
||||||
|
* Find attribute IDs by value
|
||||||
|
*
|
||||||
|
* @param ItemAttributeValue[] $defaultValues Values to search in
|
||||||
|
* @param mixed $value Value to search for
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private static function findAttributeIdByValue(array $defaultValues, mixed $value) : int
|
||||||
{
|
{
|
||||||
foreach ($defaultValues as $val) {
|
foreach ($defaultValues as $val) {
|
||||||
if ($val->valueStr === $value
|
if ($val->valueStr === $value
|
||||||
|
|
@ -228,8 +242,8 @@ final class Installer extends InstallerAbstract
|
||||||
/**
|
/**
|
||||||
* Install default relation types
|
* Install default relation types
|
||||||
*
|
*
|
||||||
* @param ApplicationAbstract $app Application
|
* @param ApplicationAbstract $app Application
|
||||||
* @param array $relations Attribute definition
|
* @param array $rels Attribute definition
|
||||||
*
|
*
|
||||||
* @return array<array>
|
* @return array<array>
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ use Modules\ItemManagement\Models\ItemRelationTypeMapper;
|
||||||
use Modules\ItemManagement\Models\NullItemAttributeType;
|
use Modules\ItemManagement\Models\NullItemAttributeType;
|
||||||
use Modules\ItemManagement\Models\NullItemAttributeValue;
|
use Modules\ItemManagement\Models\NullItemAttributeValue;
|
||||||
use Modules\ItemManagement\Models\NullItemL11nType;
|
use Modules\ItemManagement\Models\NullItemL11nType;
|
||||||
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Media\Models\PathSettings;
|
use Modules\Media\Models\PathSettings;
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
use phpOMS\Localization\BaseStringL11n;
|
||||||
use phpOMS\Localization\ISO4217CharEnum;
|
use phpOMS\Localization\ISO4217CharEnum;
|
||||||
|
|
@ -326,8 +327,8 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createItemAttributeTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
private function createItemAttributeTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$attrL11n = new BaseStringL11n();
|
$attrL11n = new BaseStringL11n();
|
||||||
$attrL11n->ref = (int) ($request->getData('type') ?? 0);
|
$attrL11n->ref = (int) ($request->getData('type') ?? 0);
|
||||||
$attrL11n->setLanguage((string) (
|
$attrL11n->setLanguage((string) (
|
||||||
$request->getData('language') ?? $request->getLanguage()
|
$request->getData('language') ?? $request->getLanguage()
|
||||||
));
|
));
|
||||||
|
|
@ -396,13 +397,13 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createItemAttributeTypeFromRequest(RequestAbstract $request) : ItemAttributeType
|
private function createItemAttributeTypeFromRequest(RequestAbstract $request) : ItemAttributeType
|
||||||
{
|
{
|
||||||
$attrType = new ItemAttributeType($request->getData('name') ?? '');
|
$attrType = new ItemAttributeType($request->getData('name') ?? '');
|
||||||
$attrType->setL11n((string) ($request->getData('title') ?? ''), $request->getData('language') ?? ISO639x1Enum::_EN);
|
$attrType->datatype = (int) ($request->getData('datatype') ?? 0);
|
||||||
$attrType->datatype = (int) ($request->getData('datatype') ?? 0);
|
|
||||||
$attrType->setFields((int) ($request->getData('fields') ?? 0));
|
|
||||||
$attrType->custom = (bool) ($request->getData('custom') ?? false);
|
$attrType->custom = (bool) ($request->getData('custom') ?? false);
|
||||||
$attrType->isRequired = (bool) ($request->getData('is_required') ?? false);
|
$attrType->isRequired = (bool) ($request->getData('is_required') ?? false);
|
||||||
$attrType->validationPattern = (string) ($request->getData('validation_pattern') ?? '');
|
$attrType->validationPattern = (string) ($request->getData('validation_pattern') ?? '');
|
||||||
|
$attrType->setL11n((string) ($request->getData('title') ?? ''), $request->getData('language') ?? ISO639x1Enum::_EN);
|
||||||
|
$attrType->setFields((int) ($request->getData('fields') ?? 0));
|
||||||
|
|
||||||
return $attrType;
|
return $attrType;
|
||||||
}
|
}
|
||||||
|
|
@ -476,6 +477,7 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createItemAttributeValueFromRequest(RequestAbstract $request) : ItemAttributeValue
|
private function createItemAttributeValueFromRequest(RequestAbstract $request) : ItemAttributeValue
|
||||||
{
|
{
|
||||||
|
/** @var ItemAttributeType $type */
|
||||||
$type = ItemAttributeTypeMapper::get()
|
$type = ItemAttributeTypeMapper::get()
|
||||||
->where('id', (int) ($request->getData('type') ?? 0))
|
->where('id', (int) ($request->getData('type') ?? 0))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
@ -550,8 +552,8 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createItemAttributeValueL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
private function createItemAttributeValueL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$attrL11n = new BaseStringL11n();
|
$attrL11n = new BaseStringL11n();
|
||||||
$attrL11n->ref = (int) ($request->getData('value') ?? 0);
|
$attrL11n->ref = (int) ($request->getData('value') ?? 0);
|
||||||
$attrL11n->setLanguage((string) (
|
$attrL11n->setLanguage((string) (
|
||||||
$request->getData('language') ?? $request->getLanguage()
|
$request->getData('language') ?? $request->getLanguage()
|
||||||
));
|
));
|
||||||
|
|
@ -811,16 +813,29 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||||
$request->getDataList('names'),
|
names: $request->getDataList('names'),
|
||||||
$request->getDataList('filenames'),
|
fileNames: $request->getDataList('filenames'),
|
||||||
$uploadedFiles,
|
files: $uploadedFiles,
|
||||||
$request->header->account,
|
account: $request->header->account,
|
||||||
__DIR__ . '/../../../Modules/Media/Files/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
|
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
|
||||||
'/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
|
virtualPath: '/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
|
||||||
$request->getData('type', 'int'),
|
|
||||||
pathSettings: PathSettings::FILE_PATH
|
pathSettings: PathSettings::FILE_PATH
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($request->hasData('type')) {
|
||||||
|
foreach ($uploaded as $file) {
|
||||||
|
$this->createModelRelation(
|
||||||
|
$request->header->account,
|
||||||
|
$file->getId(),
|
||||||
|
$request->getData('type', 'int'),
|
||||||
|
MediaMapper::class,
|
||||||
|
'types',
|
||||||
|
'',
|
||||||
|
$request->getOrigin()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->createModelRelation(
|
$this->createModelRelation(
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
(int) $request->getData('item'),
|
(int) $request->getData('item'),
|
||||||
|
|
|
||||||
|
|
@ -271,11 +271,11 @@ class Item
|
||||||
*
|
*
|
||||||
* @param string $attrName Attribute name
|
* @param string $attrName Attribute name
|
||||||
*
|
*
|
||||||
* @return null|AttributeValue
|
* @return null|ItemAttributeValue
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getAttribute(string $attrName) : ?AttributeValue
|
public function getAttribute(string $attrName) : ?ItemAttributeValue
|
||||||
{
|
{
|
||||||
foreach ($this->attributes as $attribute) {
|
foreach ($this->attributes as $attribute) {
|
||||||
if ($attribute->type->name === $attrName) {
|
if ($attribute->type->name === $attrName) {
|
||||||
|
|
@ -327,16 +327,16 @@ class Item
|
||||||
/**
|
/**
|
||||||
* Get media file by type
|
* Get media file by type
|
||||||
*
|
*
|
||||||
* @param null|int $type Media type
|
* @param int $type Media type
|
||||||
*
|
*
|
||||||
* @return Media
|
* @return Media
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getFileByType(int $type = null) : Media
|
public function getFileByType(int $type) : Media
|
||||||
{
|
{
|
||||||
foreach ($this->files as $file) {
|
foreach ($this->files as $file) {
|
||||||
if ($file->type === $type) {
|
if ($file->hasMediaTypeId($type)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ class Item
|
||||||
public function getFileByTypeName(string $type) : Media
|
public function getFileByTypeName(string $type) : Media
|
||||||
{
|
{
|
||||||
foreach ($this->files as $file) {
|
foreach ($this->files as $file) {
|
||||||
if ($file->type->name === $type) {
|
if ($file->hasMediaTypeName($type)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -364,27 +364,6 @@ class Item
|
||||||
return new NullMedia();
|
return new NullMedia();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all media files by type
|
|
||||||
*
|
|
||||||
* @param null|int $type Media type
|
|
||||||
*
|
|
||||||
* @return Media[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getFilesByType(int $type = null) : array
|
|
||||||
{
|
|
||||||
$files = [];
|
|
||||||
foreach ($this->files as $file) {
|
|
||||||
if ($file->type === $type) {
|
|
||||||
$files[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $files;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ final class ItemAttributeMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has one relation.
|
* Has one relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const OWNS_ONE = [
|
public const OWNS_ONE = [
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,8 @@ class ItemAttributeType implements \JsonSerializable
|
||||||
if ($l11n instanceof BaseStringL11n) {
|
if ($l11n instanceof BaseStringL11n) {
|
||||||
$this->l11n = $l11n;
|
$this->l11n = $l11n;
|
||||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||||
$this->l11n->content = $l11n;
|
$this->l11n->content = $l11n;
|
||||||
|
$this->l11n->setLanguage($lang);
|
||||||
} else {
|
} else {
|
||||||
$this->l11n = new BaseStringL11n();
|
$this->l11n = new BaseStringL11n();
|
||||||
$this->l11n->content = $l11n;
|
$this->l11n->content = $l11n;
|
||||||
|
|
@ -147,6 +148,10 @@ class ItemAttributeType implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function getL11n() : string
|
public function getL11n() : string
|
||||||
{
|
{
|
||||||
|
if (!isset($this->l11n)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ final class ItemAttributeTypeL11nMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Model to use by the mapper.
|
* Model to use by the mapper.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var class-string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const MODEL = BaseStringL11n::class;
|
public const MODEL = BaseStringL11n::class;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ final class ItemAttributeTypeMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has many relation.
|
* Has many relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const HAS_MANY = [
|
public const HAS_MANY = [
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,8 @@ class ItemAttributeValue implements \JsonSerializable
|
||||||
if ($l11n instanceof BaseStringL11n) {
|
if ($l11n instanceof BaseStringL11n) {
|
||||||
$this->l11n = $l11n;
|
$this->l11n = $l11n;
|
||||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||||
$this->l11n->content = $l11n;
|
$this->l11n->content = $l11n;
|
||||||
|
$this->l11n->setLanguage($lang);
|
||||||
} else {
|
} else {
|
||||||
$this->l11n = new BaseStringL11n();
|
$this->l11n = new BaseStringL11n();
|
||||||
$this->l11n->content = $l11n;
|
$this->l11n->content = $l11n;
|
||||||
|
|
@ -159,8 +160,8 @@ class ItemAttributeValue implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* Set value
|
* Set value
|
||||||
*
|
*
|
||||||
* @param int|string|float|\DateTimeInterface $value Value
|
* @param int|string|float $value Value
|
||||||
* @param int $type Datatype
|
* @param int $datatype Datatype
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -178,7 +179,7 @@ class ItemAttributeValue implements \JsonSerializable
|
||||||
} elseif ($datatype === AttributeValueType::_FLOAT) {
|
} elseif ($datatype === AttributeValueType::_FLOAT) {
|
||||||
$this->valueDec = (float) $value;
|
$this->valueDec = (float) $value;
|
||||||
} elseif ($datatype === AttributeValueType::_DATETIME) {
|
} elseif ($datatype === AttributeValueType::_DATETIME) {
|
||||||
$this->valueDat = new \DateTime($value);
|
$this->valueDat = new \DateTime((string) $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ final class ItemAttributeValueL11nMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Model to use by the mapper.
|
* Model to use by the mapper.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var class-string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const MODEL = BaseStringL11n::class;
|
public const MODEL = BaseStringL11n::class;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ final class ItemAttributeValueMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has many relation.
|
* Has many relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const HAS_MANY = [
|
public const HAS_MANY = [
|
||||||
|
|
|
||||||
0
Models/ItemL11n.php
Executable file → Normal file
0
Models/ItemL11n.php
Executable file → Normal file
|
|
@ -43,7 +43,7 @@ final class ItemL11nMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has one relation.
|
* Has one relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const OWNS_ONE = [
|
public const OWNS_ONE = [
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ final class ItemMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has many relation.
|
* Has many relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const HAS_MANY = [
|
public const HAS_MANY = [
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ final class ItemRelationMapper extends DataMapperFactory
|
||||||
/**
|
/**
|
||||||
* Has one relation.
|
* Has one relation.
|
||||||
*
|
*
|
||||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const OWNS_ONE = [
|
public const OWNS_ONE = [
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ trait ApiControllerAttributeTrait
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', 'TestItemL11nType');
|
$request->setData('title', 'TestItemL11nType');
|
||||||
|
$request->setData('name', 'test_name');
|
||||||
|
$request->setData('language', ISO639x1Enum::_EN);
|
||||||
|
|
||||||
$this->module->apiItemL11nTypeCreate($request, $response);
|
$this->module->apiItemL11nTypeCreate($request, $response);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||||
|
|
@ -105,8 +107,7 @@ trait ApiControllerAttributeTrait
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('default', '1');
|
$request->setData('default', '1');
|
||||||
$request->setData('attributetype', '1');
|
$request->setData('type', '1');
|
||||||
$request->setData('type', AttributeValueType::_INT);
|
|
||||||
$request->setData('value', '1');
|
$request->setData('value', '1');
|
||||||
$request->setData('language', ISO639x1Enum::_DE);
|
$request->setData('language', ISO639x1Enum::_DE);
|
||||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||||
|
|
@ -125,8 +126,7 @@ trait ApiControllerAttributeTrait
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('attributetype', '1');
|
$request->setData('type', '1');
|
||||||
$request->setData('type', AttributeValueType::_STRING);
|
|
||||||
$request->setData('value', '1');
|
$request->setData('value', '1');
|
||||||
$request->setData('language', ISO639x1Enum::_DE);
|
$request->setData('language', ISO639x1Enum::_DE);
|
||||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||||
|
|
@ -145,8 +145,7 @@ trait ApiControllerAttributeTrait
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('attributetype', '1');
|
$request->setData('type', '1');
|
||||||
$request->setData('type', AttributeValueType::_FLOAT);
|
|
||||||
$request->setData('value', '1.1');
|
$request->setData('value', '1.1');
|
||||||
$request->setData('language', ISO639x1Enum::_DE);
|
$request->setData('language', ISO639x1Enum::_DE);
|
||||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||||
|
|
@ -165,8 +164,7 @@ trait ApiControllerAttributeTrait
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest(new HttpUri(''));
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('attributetype', '1');
|
$request->setData('type', '1');
|
||||||
$request->setData('type', AttributeValueType::_DATETIME);
|
|
||||||
$request->setData('value', '2020-08-02');
|
$request->setData('value', '2020-08-02');
|
||||||
$request->setData('language', ISO639x1Enum::_DE);
|
$request->setData('language', ISO639x1Enum::_DE);
|
||||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ trait ApiControllerItemTrait
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', '123456 backend');
|
$request->setData('name', '123456 backend');
|
||||||
$request->setData('item', 1);
|
$request->setData('item', 1);
|
||||||
$request->setData('type', 'backend_image');
|
$request->setData('type', '1');
|
||||||
|
|
||||||
TestUtils::setMember($request, 'files', [
|
TestUtils::setMember($request, 'files', [
|
||||||
'file1' => [
|
'file1' => [
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals(ItemStatus::ACTIVE, $this->item->getStatus());
|
self::assertEquals(ItemStatus::ACTIVE, $this->item->getStatus());
|
||||||
self::assertEquals([], $this->item->getNotes());
|
self::assertEquals([], $this->item->getNotes());
|
||||||
self::assertEquals([], $this->item->getFiles());
|
self::assertEquals([], $this->item->getFiles());
|
||||||
self::assertInstanceOf('\Modules\Media\Models\Media', $this->item->getFileByType());
|
|
||||||
self::assertEquals([], $this->item->getFilesByType());
|
|
||||||
self::assertEquals([], $this->item->getAttributes());
|
self::assertEquals([], $this->item->getAttributes());
|
||||||
self::assertInstanceOf('Modules\ItemManagement\Models\ItemL11n', $this->item->getL11n(''));
|
self::assertInstanceOf('Modules\ItemManagement\Models\ItemL11n', $this->item->getL11n(''));
|
||||||
self::assertInstanceOf('phpOMS\Localization\Money', $this->item->salesPrice);
|
self::assertInstanceOf('phpOMS\Localization\Money', $this->item->salesPrice);
|
||||||
|
|
@ -75,8 +73,6 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
$this->item->addFile($temp = new Media());
|
$this->item->addFile($temp = new Media());
|
||||||
self::assertCount(1, $this->item->getFiles());
|
self::assertCount(1, $this->item->getFiles());
|
||||||
self::assertEquals($temp, $this->item->getFileByType());
|
|
||||||
self::assertEquals([$temp], $this->item->getFilesByType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user