test fixes and changes for release

This commit is contained in:
Dennis Eichhorn 2022-12-25 00:06:17 +01:00
parent d505406976
commit 672b72e176
19 changed files with 910 additions and 275 deletions

View File

@ -1,7 +1,91 @@
[
{
"id": "color",
"name": {
"name": "segment",
"l11n": {
"en": "Segment",
"de": "Segment"
},
"value_type": "int",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": [
{
"value": 1,
"l11n": {
"en": "Segment 1",
"de": "Segment 1"
}
}
]
},
{
"name": "section",
"l11n": {
"en": "Section",
"de": "Sparte"
},
"value_type": "int",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": [
{
"value": 1,
"l11n": {
"en": "Section 1",
"de": "Section 1"
}
}
]
},
{
"name": "product_group",
"l11n": {
"en": "Product Group",
"de": "Produktgruppe"
},
"value_type": "int",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": [
{
"value": 1,
"l11n": {
"en": "Group 1",
"de": "Gruppe 1"
}
}
]
},
{
"name": "product_type",
"l11n": {
"en": "Product Type",
"de": "Produkttyp"
},
"value_type": "int",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": [
{
"value": 1,
"l11n": {
"en": "Type 1",
"de": "Typ 1"
}
}
]
},
{
"name": "color",
"l11n": {
"en": "Color",
"de": "Farbe"
},
@ -12,65 +96,189 @@
"default_value": "",
"values": [
{
"name": {
"value": "red",
"l11n": {
"en": "Red",
"de": "Rot"
}
},
{
"name": {
"value": "green",
"l11n": {
"en": "Green",
"de": "Gruen"
}
},
{
"value": "blue",
"l11n": {
"en": "Blue",
"de": "Blau"
}
},
{
"value": "white",
"l11n": {
"en": "White",
"de": "Weiss"
}
},
{
"value": "black",
"l11n": {
"en": "Black",
"de": "Schwarz"
}
}
]
},
{
"id": "length",
"name": {
"name": "length",
"l11n": {
"en": "Length",
"de": "Laenge"
},
"value_type": "string",
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"id": "weight",
"name": {
"name": "weight",
"value_type": "string",
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"l11n": {
"en": "Weight",
"de": "Gewicht"
},
"values": []
},
{
"id": "origin",
"name": {
"name": "origin",
"l11n": {
"en": "Country of origin",
"de": "Herkunftsland"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": []
},
{
"id": "license",
"name": {
"name": "license",
"l11n": {
"en": "License",
"de": "Lizenz"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"id": "payment_model",
"name": {
"en": "Payment Model",
"de": "Zahlungsweise"
"name": "it_platform",
"l11n": {
"en": "Platform",
"de": "Plattform"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"en": "Subscription",
"de": "Abo"
"value": "cloud",
"is_default": true,
"l11n": {
"en": "Cloud",
"de": "Cloud"
}
},
{
"en": "pay-per-use",
"de": "Einmalzahlung"
"value": "local",
"is_default": true,
"l11n": {
"en": "Local",
"de": "Lokal"
}
},
{
"value": "mobile",
"is_default": true,
"l11n": {
"en": "Mobile",
"de": "Mobil"
}
}
]
},
{
"name": "os",
"l11n": {
"en": "Operating System",
"de": "Betriebssystem"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": "windows",
"is_default": true,
"l11n": {
"en": "Windows",
"de": "Windows"
}
},
{
"value": "linux",
"is_default": true,
"l11n": {
"en": "Linux",
"de": "Linux"
}
},
{
"value": "osx",
"is_default": true,
"l11n": {
"en": "OSX",
"de": "OSX"
}
}
]
}
{
"name": "os_version",
"l11n": {
"en": "Operating System Version",
"de": "Betriebssystem Version"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": "win7",
"is_default": true
},
{
"value": "win10",
"is_default": true
}
]
}

View File

@ -37,6 +37,14 @@
"type": "BIGINT",
"default": null,
"null": true
},
"itemmgmt_item_parent": {
"name": "itemmgmt_item_parent",
"type": "INT(11)",
"null": true,
"default": null,
"foreignTable": "itemmgmt_item",
"foreignKey": "itemmgmt_item_id"
}
}
},
@ -54,6 +62,12 @@
"name": "itemmgmt_item_l11n_type_title",
"type": "VARCHAR(255)",
"null": false
},
"itemmgmt_item_l11n_type_required": {
"description": "Every item must have this attribute type if set to true.",
"name": "itemmgmt_item_l11n_type_required",
"type": "TINYINT(1)",
"null": false
}
}
},
@ -180,8 +194,8 @@
"type": "TINYINT(1)",
"null": false
},
"itemmgmt_attr_value_type": {
"name": "itemmgmt_attr_value_type",
"itemmgmt_attr_value_valuetype": {
"name": "itemmgmt_attr_value_valuetype",
"type": "INT(11)",
"null": false
},
@ -213,7 +227,7 @@
"name": "itemmgmt_attr_value_unit",
"type": "VARCHAR(255)",
"null": false
},
}
}
},
"itemmgmt_attr_value_l11n": {
@ -231,7 +245,7 @@
"type": "VARCHAR(255)",
"null": false
},
"itemmgmt_attr_value_l11n_type": {
"itemmgmt_attr_value_l11n_value": {
"name": "itemmgmt_attr_value_l11n_value",
"type": "INT(11)",
"null": false,
@ -322,6 +336,13 @@
"type": "VARCHAR(255)",
"null": false
},
"itemmgmt_item_sales_price_currency": {
"name": "itemmgmt_item_sales_price_currency",
"type": "VARCHAR(3)",
"null": false,
"foreignTable": "currency",
"foreignKey": "currency_code"
},
"itemmgmt_item_sales_price_price": {
"name": "itemmgmt_item_sales_price_price",
"type": "INT(11)",
@ -357,16 +378,6 @@
"type": "INT(11)",
"null": false
},
"itemmgmt_item_sales_price_region": {
"name": "itemmgmt_item_sales_price_region",
"type": "INT(11)",
"null": false
},
"itemmgmt_item_sales_price_country": {
"name": "itemmgmt_item_sales_price_country",
"type": "INT(11)",
"null": false
},
"itemmgmt_item_sales_price_start": {
"name": "itemmgmt_item_sales_price_start",
"type": "INT(11)",
@ -378,7 +389,7 @@
"null": false
},
"itemmgmt_item_sales_price_promocode": {
"name": "itemmgmt_item_sales_price_end",
"name": "itemmgmt_item_sales_price_promocode",
"type": "INT(11)",
"null": false
}
@ -387,7 +398,7 @@
"itemmgmt_item_sales_price_relation": {
"name": "itemmgmt_item_sales_price_relation",
"fields": {
"itemmgmt_item_note_id": {
"itemmgmt_item_sales_price_relation_id": {
"name": "itemmgmt_item_sales_price_relation_id",
"type": "INT",
"null": false,
@ -402,29 +413,29 @@
"foreignTable": "itemmgmt_item",
"foreignKey": "itemmgmt_item_id"
},
"itemmgmt_item_sales_price_relation_itemgroup": {
"name": "itemmgmt_item_sales_price_relation_itemgroup",
"itemmgmt_item_sales_price_relation_attr": {
"name": "itemmgmt_item_sales_price_relation_attr",
"type": "INT",
"null": true,
"default": null,
"foreignTable": "itemmgmt_item",
"foreignKey": "itemmgmt_item_id"
"foreignTable": "itemmgmt_attr_value",
"foreignKey": "itemmgmt_attr_value_id"
},
"itemmgmt_item_sales_price_relation_client": {
"name": "itemmgmt_item_sales_price_relation_client",
"type": "INT",
"null": true,
"default": null,
"foreignTable": "clientmgmt_client",
"foreignKey": "clientmgmt_client_id"
"foreignTable": "account",
"foreignKey": "account_id"
},
"itemmgmt_item_sales_price_relation_clientgroup": {
"name": "itemmgmt_item_sales_price_relation_clientgroup",
"type": "INT",
"null": true,
"default": null,
"foreignTable": "clientmgmt_client",
"foreignKey": "clientmgmt_client_id"
"foreignTable": "account",
"foreignKey": "account_id"
},
"itemmgmt_item_sales_price_relation_price": {
"name": "itemmgmt_item_sales_price_relation_price",
@ -433,6 +444,19 @@
"default": null,
"foreignTable": "itemmgmt_item_sales_price",
"foreignKey": "itemmgmt_item_sales_price_id"
},
"itemmgmt_item_sales_price_relation_region": {
"name": "itemmgmt_item_sales_price_relation_region",
"type": "INT(11)",
"null": false
},
"itemmgmt_item_sales_price_relation_country": {
"name": "itemmgmt_item_sales_price_relation_country",
"type": "VARCHAR(2)",
"null": true,
"default": null,
"foreignTable": "country",
"foreignKey": "country_code2"
}
}
},

View File

View File

@ -0,0 +1,60 @@
{
"name": "payment_model",
"l11n": {
"en": "Payment Model",
"de": "Zahlungsmittel"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": "subscription",
"is_default": true,
"l11n": {
"en": "Subscription",
"de": "Abo"
}
},
{
"value": "pay-per-use",
"is_default": true,
"l11n": {
"en": "Pay-Per-Use",
"de": "Einmalzahlung"
}
}
]
},
{
"name": "payment_interval",
"l11n": {
"en": "Payment interval",
"de": "Zahlungsintervall"
},
"value_type": "string",
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": "daily",
"is_default": true,
"l11n": {
"en": "daily",
"de": "taeglich"
}
},
{
"value": "monthly",
"is_default": true,
"l11n": {
"en": "monthly",
"de": "monatlich"
}
}
]
}

View File

@ -21,11 +21,16 @@ use Modules\ItemManagement\Models\ItemAttributeTypeL11nMapper;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemAttributeValue;
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
use Modules\ItemManagement\Models\ItemAttributeValueL11n;
use Modules\ItemManagement\Models\ItemAttributeValueL11nMapper;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Config\SettingsInterface;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Uri\HttpUri;
/**
* Installer class.
@ -52,38 +57,114 @@ final class Installer extends InstallerAbstract
{
parent::install($app, $info, $cfgHandler);
$attrTypes = self::createItemAttributeTypes();
self::createItemAttributeValues($attrTypes);
$fileContent = \file_get_contents(__DIR__ . '/Install/attributes.json');
if ($fileContent === false) {
return;
}
$attributes = \json_decode($fileContent);
$attrTypes = self::createItemAttributeTypes($app, $attributes);
self::createItemAttributeValues($app, $attrTypes, $attributes);
$fileContent = \file_get_contents(__DIR__ . '/Install/localizations.json');
if ($fileContent === false) {
return;
}
$localizations = \json_decode($fileContent);
$l11nTypes = self::createItemL11nTypes($app, $localizations);
}
/**
* Install default l11n types
*
* @param ApplicationAbstract $app Application
* @param array $l11ns Attribute definition
*
* @return array<array>
*
* @since 1.0.0
*/
private static function createItemL11nTypes(ApplicationAbstract $app, array $l11ns) : array
{
/** @var array<string, array> $l11nTypes */
$l11nTypes = [];
/** @var \Modules\ItemManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('ItemManagement');
foreach ($l11ns as $l11n) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = \mt_rand(2, 5);
$request->setData('title', $l11n['name']);
$request->setData('is_required', $l11n['is_required'] ?? false);
$module->apiItemL11nTypeCreate($request, $response);
$l11nTypes[] = !\is_array($response->get('')['response'])
? $response->get('')['response']->toArray()
: $response->get('')['response'];
}
return $l11nTypes;
}
/**
* Install default attribute types
*
* @return ItemAttributeType[]
* @param ApplicationAbstract $app Application
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createItemAttributeTypes() : array
private static function createItemAttributeTypes(ApplicationAbstract $app, array $attributes) : array
{
/** @var array<string, array> $itemAttrType */
$itemAttrType = [];
$itemAttrType['color'] = new ItemAttributeType('color');
ItemAttributeTypeMapper::create()->execute($itemAttrType['color']);
ItemAttributeTypeL11nMapper::create()->execute(new ItemAttributeTypeL11n($itemAttrType['color']->getId(), 'Color', ISO639x1Enum::_EN));
ItemAttributeTypeL11nMapper::create()->execute(new ItemAttributeTypeL11n($itemAttrType['color']->getId(), 'Farbe', ISO639x1Enum::_DE));
/** @var \Modules\ItemManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('ItemManagement');
// weight
// segment_level_1
// segment_level_2
// segment_level_3
// segment_level_4
// product_group
// consumable
// packaging
// service
// machine
// spare part
// transportation
foreach ($attributes as $attribute) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('name', $attribute['name'] ?? '');
$request->setData('title', $attribute['l11n'][0] ?? '');
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('is_custom_allowed', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
$module->apiItemAttributeTypeCreate($request, $response);
$itemAttrType[$attribute['name']] = !\is_array($response->get('')['response'])
? $response->get('')['response']->toArray()
: $response->get('')['response'];
$isFirst = true;
foreach ($attribute['l11n'] as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('type', $itemAttrType[$attribute['name']]['id']);
$module->apiItemAttributeTypeL11nCreate($request, $response);
}
}
return $itemAttrType;
}
@ -91,104 +172,68 @@ final class Installer extends InstallerAbstract
/**
* Create default attribute values for types
*
* @param ItemAttributeType[] $itemAttrType Attribute types
* @param ApplicationAbstract $app Application
* @param array $itemAttrType Attribute types
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, ItemAttributeValue[]>
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createItemAttributeValues(array $itemAttrType) : array
private static function createItemAttributeValues(ApplicationAbstract $app, array $itemAttrType, array $attributes) : array
{
/** @var array<string, array> $itemAttrValue */
$itemAttrValue = [];
$itemAttrValue['color'] = [];
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Red', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][0]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
/** @var \Modules\ItemManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('ItemManagement');
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Rot', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][1]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
foreach ($attributes as $attribute) {
$itemAttrValue[$attribute['name']] = [];
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Blue', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][2]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
foreach ($attribute['values'] as $value) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Blau', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][3]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$request->header->account = 1;
$request->setData('value', $value['value'] ?? '');
$request->setData('value_type', $attribute['value_type'] ?? 0);
$request->setData('unit', $value['unit'] ?? '');
$request->setData('default', isset($attribute['values']) && !empty($attribute['values']));
$request->setData('attributetype', $itemAttrType[$attribute['name']]['id']);
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Green', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][4]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
if (isset($value['l11n']) && !empty($value['l11n'])) {
$request->setData('title', $value['l11n'][0] ?? '');
$request->setData('language', \array_keys($value['l11n'])[0] ?? 'en');
}
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Grün', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][5]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$module->apiItemAttributeValueCreate($request, $response);
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Yellow', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][6]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$attrValue = !\is_array($response->get('')['response'])
? $response->get('')['response']->toArray()
: $response->get('')['response'];
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Gelb', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][7]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue[$attribute['name']][] = $attrValue;
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'White', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][8]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$isFirst = true;
foreach (($value['l11n'] ?? []) as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Weiss', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][9]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Black', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][10]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('value', $attrValue['id']);
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Schwarz', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][11]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Braun', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][12]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Braun', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][13]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Purple', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][14]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Lila', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][15]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Pink', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][16]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Rosa', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][17]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Orange', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][18]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Orange', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][19]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Grey', ISO639x1Enum::_EN);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][20]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$itemAttrValue['color'][] = new ItemAttributeValue(AttributeValueType::_STRING, 'Grau', ISO639x1Enum::_DE);
$id = ItemAttributeValueMapper::create()->execute($itemAttrValue['color'][21]);
ItemAttributeTypeMapper::writer()->createRelationTable('defaults', [$id], $itemAttrType['color']->getId());
$module->apiItemAttributeValueL11nCreate($request, $response);
}
}
}
return $itemAttrValue;
}

View File

@ -24,16 +24,22 @@ use Modules\ItemManagement\Models\ItemAttributeTypeL11nMapper;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemAttributeValue;
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
use Modules\ItemManagement\Models\ItemAttributeValueL11n;
use Modules\ItemManagement\Models\ItemAttributeValueL11nMapper;
use Modules\ItemManagement\Models\ItemL11n;
use Modules\ItemManagement\Models\ItemL11nMapper;
use Modules\ItemManagement\Models\ItemL11nType;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\ItemManagement\Models\ItemPrice;
use Modules\ItemManagement\Models\ItemPriceStatus;
use Modules\ItemManagement\Models\ItemPriceMapper;
use Modules\ItemManagement\Models\NullItemAttributeType;
use Modules\ItemManagement\Models\NullItemAttributeValue;
use Modules\ItemManagement\Models\NullItemL11nType;
use Modules\Media\Models\PathSettings;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\Money;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\NotificationLevel;
@ -94,6 +100,7 @@ final class ApiController extends Controller
$item->salesPrice = new Money($request->getData('salesprice', 'int') ?? 0);
$item->purchasePrice = new Money($request->getData('purchaseprice', 'int') ?? 0);
$item->info = $request->getData('info') ?? '';
$item->parent = ($request->getData('parent') !== null) ? (int) $request->getData('parent') : null;
return $item;
}
@ -117,6 +124,88 @@ final class ApiController extends Controller
return [];
}
/**
* Api method to create item
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemPriceCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if (!empty($val = $this->validateItemPriceCreate($request))) {
$response->set('item_create', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
return;
}
$item = $this->createItemPriceFromRequest($request);
$this->createModel($request->header->account, $item, ItemMapper::class, 'item', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Item', 'Item successfully created', $item);
}
/**
* Method to create item from request.
*
* @param RequestAbstract $request Request
*
* @return ItemPrice
*
* @since 1.0.0
*/
private function createItemPriceFromRequest(RequestAbstract $request) : ItemPrice
{
$item = new ItemPrice();
$item->currency = $request->getData('currency') ?? '';
$item->price = new Money($request->getData('price', 'int') ?? 0);
$item->minQuantity = (int) ($request->getData('minquantity') ?? 0);
$item->relativeDiscount = (int) ($request->getData('relativediscount') ?? 0);
$item->absoluteDiscount = (int) ($request->getData('absolutediscount') ?? 0);
$item->relativeUnitDiscount = (int) ($request->getData('relativeunitdiscount') ?? 0);
$item->absoluteUnitDiscount = (int) ($request->getData('absoluteunitdiscount') ?? 0);
$item->promocode = $request->getData('promocode') ?? '';
$item->setStatus((int) ($request->getData('status') ?? ItemPriceStatus::ACTIVE));
$item->start = ($request->getData('start') === null)
? null
: new \DateTime($request->getData('start'));
$item->end = ($request->getData('end') === null)
? null
: new \DateTime($request->getData('end'));
return $item;
}
/**
* Validate item create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateItemPriceCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['price'] = empty($request->getData('price')))
|| ($val['currency'] = !ISO4217CharEnum::isValidValue($request->getData('currency')))
) {
return $val;
}
return [];
}
/**
* Api method to create item attribute
*
@ -155,10 +244,20 @@ final class ApiController extends Controller
*/
private function createItemAttributeFromRequest(RequestAbstract $request) : ItemAttribute
{
$attribute = new ItemAttribute();
$attribute->item = (int) $request->getData('item');
$attribute->type = new NullItemAttributeType((int) $request->getData('type'));
$attribute->value = new NullItemAttributeValue((int) $request->getData('value'));
$attribute = new ItemAttribute();
$attribute->item = (int) $request->getData('item');
$attribute->type = new NullItemAttributeType((int) $request->getData('type'));
if ($request->getData('value') !== null) {
$attribute->value = new NullItemAttributeValue((int) $request->getData('value'));
} else {
$newRequest = clone $request;
$newRequest->setData('value', $request->getData('custom'), true);
$value = $this->createItemAttributeValueFromRequest($request);
$attribute->value = $value;
}
return $attribute;
}
@ -176,7 +275,7 @@ final class ApiController extends Controller
{
$val = [];
if (($val['type'] = empty($request->getData('type')))
|| ($val['value'] = empty($request->getData('value')))
|| ($val['value'] = (empty($request->getData('value')) && empty($request->getData('custom'))))
|| ($val['item'] = empty($request->getData('item')))
) {
return $val;
@ -293,10 +392,12 @@ final class ApiController extends Controller
*/
private function createItemAttributeTypeFromRequest(RequestAbstract $request) : ItemAttributeType
{
$attrType = new ItemAttributeType();
$attrType = new ItemAttributeType($request->getData('name') ?? '');
$attrType->setL11n((string) ($request->getData('title') ?? ''), $request->getData('language') ?? ISO639x1Enum::_EN);
$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->validationPattern = $request->getData('validation_pattern') ?? '';
return $attrType;
}
@ -314,6 +415,7 @@ final class ApiController extends Controller
{
$val = [];
if (($val['title'] = empty($request->getData('title')))
|| ($val['name'] = empty($request->getData('name')))
) {
return $val;
}
@ -369,28 +471,13 @@ final class ApiController extends Controller
*/
private function createItemAttributeValueFromRequest(RequestAbstract $request) : ItemAttributeValue
{
$attrValue = new ItemAttributeValue();
$type = (int) ($request->getData('type') ?? 0);
$type = $request->getData('type') ?? 0;
if ($type === AttributeValueType::_INT) {
$attrValue->valueInt = (int) $request->getData('value');
} elseif ($type === AttributeValueType::_STRING) {
$attrValue->valueStr = (string) $request->getData('value');
} elseif ($type === AttributeValueType::_FLOAT) {
$attrValue->valueDec = (float) $request->getData('value');
} elseif ($type === AttributeValueType::_DATETIME) {
$attrValue->valueDat = new \DateTime($request->getData('value') ?? '');
}
$attrValue->type = $type;
$attrValue = new ItemAttributeValue($type, $request->getData('value'));
$attrValue->isDefault = (bool) ($request->getData('default') ?? false);
if ($request->hasData('language')) {
$attrValue->setLanguage((string) ($request->getData('language') ?? $request->getLanguage()));
}
if ($request->hasData('country')) {
$attrValue->setCountry((string) ($request->getData('country') ?? $request->header->l11n->getCountry()));
if ($request->getData('title') !== null) {
$attrValue->setL11n($request->getData('title'), $request->getData('language') ?? ISO639x1Enum::_EN);
}
return $attrValue;
@ -417,6 +504,75 @@ final class ApiController extends Controller
return [];
}
/**
* Api method to create item attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if (!empty($val = $this->validateItemAttributeValueL11nCreate($request))) {
$response->set('attr_value_l11n_create', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
return;
}
$attrL11n = $this->createItemAttributeValueL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, ItemAttributeValueL11nMapper::class, 'attr_value_l11n', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Attribute type localization', 'Attribute type localization successfully created', $attrL11n);
}
/**
* Method to create item attribute l11n from request.
*
* @param RequestAbstract $request Request
*
* @return ItemAttributeValueL11n
*
* @since 1.0.0
*/
private function createItemAttributeValueL11nFromRequest(RequestAbstract $request) : ItemAttributeValueL11n
{
$attrL11n = new ItemAttributeValueL11n();
$attrL11n->value = (int) ($request->getData('value') ?? 0);
$attrL11n->setLanguage((string) (
$request->getData('language') ?? $request->getLanguage()
));
$attrL11n->title = (string) ($request->getData('title') ?? '');
return $attrL11n;
}
/**
* Validate item attribute l11n create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateItemAttributeValueL11nCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['title'] = empty($request->getData('title')))
|| ($val['value'] = empty($request->getData('value')))
) {
return $val;
}
return [];
}
/**
* Api method to create item l11n type
*
@ -455,8 +611,9 @@ final class ApiController extends Controller
*/
private function createItemL11nTypeFromRequest(RequestAbstract $request) : ItemL11nType
{
$itemL11nType = new ItemL11nType();
$itemL11nType->title = (string) ($request->getData('title') ?? '');
$itemL11nType = new ItemL11nType();
$itemL11nType->title = (string) ($request->getData('title') ?? '');
$itemL11nType->isRequired = (bool) ($request->getData('is_required') ?? false);
return $itemL11nType;
}

View File

@ -20,7 +20,7 @@ use Modules\Media\Models\NullMedia;
use phpOMS\Localization\Money;
/**
* Account class.
* Item class.
*
* @package Modules\ItemManagement\Models
* @license OMS License 1.0
@ -47,6 +47,8 @@ class Item
public int $successor = 0;
public ?int $parent = null;
private int $status = ItemStatus::ACTIVE;
public Money $salesPrice;
@ -85,11 +87,9 @@ class Item
*/
private array $attributes = [];
private ?int $partslist = null;
public ?int $partslist = null;
private array $purchase = [];
private ?int $disposal = null;
public ?int $disposal = null;
/**
* Created at.

View File

@ -40,7 +40,7 @@ class ItemAttributeType implements \JsonSerializable
* @var string
* @since 1.0.0
*/
public string $name = ''; // @todo: currently not filled, should be used as identifier or if not required removed (at the moment it seems like it is useless?!)
public string $name = '';
/**
* Which field data type is required (string, int, ...) in the value
@ -67,7 +67,7 @@ class ItemAttributeType implements \JsonSerializable
*
* @var ItemAttributeTypeL11n
*/
private string | ItemAttributeTypeL11n $l11n;
private string | ItemAttributeTypeL11n $l11n = '';
/**
* Possible default attribute values
@ -93,7 +93,7 @@ class ItemAttributeType implements \JsonSerializable
*/
public function __construct(string $name = '')
{
$this->setL11n($name);
$this->name = $name;
}
/**
@ -155,6 +155,18 @@ class ItemAttributeType implements \JsonSerializable
$this->fields = $fields;
}
/**
* Get default values
*
* @return array
*
* @sicne 1.0.0
*/
public function getDefaults() : array
{
return $this->defaults;
}
/**
* {@inheritdoc}
*/

View File

@ -38,7 +38,7 @@ class ItemAttributeValue implements \JsonSerializable
protected int $id = 0;
/**
* Type of the attribute
* Datatype of the attribute
*
* @var int
* @since 1.0.0
@ -85,9 +85,13 @@ class ItemAttributeValue implements \JsonSerializable
*/
public bool $isDefault = false;
// @todo: The following l11n is bad!!!
// the l11n should be separate, because we want to know which value it is despite the l11n
// it should be basically the same ass the itemattributetype which has a itemattributetypel11n element.
/**
* Unit of the value
*
* @var string
* @since 1.0.0
*/
public string $unit = '';
/**
* Localization
@ -104,15 +108,11 @@ class ItemAttributeValue implements \JsonSerializable
*
* @since 1.0.0
*/
public function __construct(int $type = 0, mixed $value = '', string $name = '')
public function __construct(int $type = 0, mixed $value = '')
{
$this->type = $type;
$this->setValue($value);
if (!empty($name)) {
$this->setL11n($name);
}
}
/**
@ -131,8 +131,8 @@ class ItemAttributeValue implements \JsonSerializable
/**
* Set l11n
*
* @param string|ItemAttributeTypeL11n $l11n Tag article l11n
* @param string $lang Language
* @param string|ItemAttributeValueL11n $l11n Tag article l11n
* @param string $lang Language
*
* @return void
*
@ -152,13 +152,15 @@ class ItemAttributeValue implements \JsonSerializable
}
/**
* @return string
* Get localization
*
* @return null|string
*
* @since 1.0.0
*/
public function getL11n() : string
public function getL11n() : ?string
{
return $this->l11n instanceof ItemAttributeTypeL11n ? $this->l11n->title : $this->l11n;
return $this->l11n instanceof ItemAttributeValueL11n ? $this->l11n->title : $this->l11n;
}
/**
@ -205,58 +207,6 @@ class ItemAttributeValue implements \JsonSerializable
return null;
}
/**
* Set language
*
* @param string $language Language
*
* @return void
*
* @since 1.0.0
*/
public function setLanguage(string $language) : void
{
$this->language = $language;
}
/**
* Get language
*
* @return string
*
* @since 1.0.0
*/
public function getLanguage() : string
{
return $this->language;
}
/**
* Set country
*
* @param string $country Country
*
* @return void
*
* @since 1.0.0
*/
public function setCountry(string $country) : void
{
$this->country = $country;
}
/**
* Get country
*
* @return string
*
* @since 1.0.0
*/
public function getCountry() : string
{
return $this->country;
}
/**
* {@inheritdoc}
*/
@ -270,8 +220,6 @@ class ItemAttributeValue implements \JsonSerializable
'valueDec' => $this->valueDec,
'valueDat' => $this->valueDat,
'isDefault' => $this->isDefault,
'language' => $this->language,
'country' => $this->country,
];
}

View File

@ -35,11 +35,12 @@ final class ItemAttributeValueMapper extends DataMapperFactory
public const COLUMNS = [
'itemmgmt_attr_value_id' => ['name' => 'itemmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_attr_value_default' => ['name' => 'itemmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'itemmgmt_attr_value_type' => ['name' => 'itemmgmt_attr_value_type', 'type' => 'int', 'internal' => 'type'],
'itemmgmt_attr_value_valuetype' => ['name' => 'itemmgmt_attr_value_valuetype', 'type' => 'int', 'internal' => 'type'],
'itemmgmt_attr_value_valueStr' => ['name' => 'itemmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'itemmgmt_attr_value_valueInt' => ['name' => 'itemmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'itemmgmt_attr_value_valueDec' => ['name' => 'itemmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'itemmgmt_attr_value_valueDat' => ['name' => 'itemmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'itemmgmt_attr_value_unit' => ['name' => 'itemmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
];
/**

View File

@ -40,6 +40,14 @@ class ItemL11nType implements \JsonSerializable
*/
public string $title = '';
/**
* Is the l11n type required for an item?
*
* @var bool
* @since 1.0.0
*/
public bool $isRequired = false;
/**
* Constructor.
*

View File

@ -35,6 +35,7 @@ final class ItemL11nTypeMapper extends DataMapperFactory
public const COLUMNS = [
'itemmgmt_item_l11n_type_id' => ['name' => 'itemmgmt_item_l11n_type_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_l11n_type_title' => ['name' => 'itemmgmt_item_l11n_type_title', 'type' => 'string', 'internal' => 'title'],
'itemmgmt_item_l11n_type_required' => ['name' => 'itemmgmt_item_l11n_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
];
/**

View File

@ -41,6 +41,7 @@ final class ItemMapper extends DataMapperFactory
'itemmgmt_item_info' => ['name' => 'itemmgmt_item_info', 'type' => 'string', 'internal' => 'info'],
'itemmgmt_item_salesprice' => ['name' => 'itemmgmt_item_salesprice', 'type' => 'Serializable', 'internal' => 'salesPrice'],
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
];
/**

144
Models/ItemPrice.php Normal file
View File

@ -0,0 +1,144 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use phpOMS\Localization\Money;
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
/**
* Account class.
*
* @package Modules\ItemManagement\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
class ItemPrice implements \JsonSerializable
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public string $name = '';
public string $currency = '';
public Money $price;
public int $status = ItemPriceStatus::ACTIVE;
public int $minQuantity = 0;
public int $relativeDiscount = 0;
public int $absoluteDiscount = 0;
public int $relativeUnitDiscount = 0;
public int $absoluteUnitDiscount = 0;
public string $promocode = '';
public ?\DateTime $start = null;
public ?\DateTime $end = null;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/**
* Get status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set status
*
* @param int $status Price status
*
* @return void
*
* @throws InvalidEnumValue
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
if (!ItemPriceStatus::isValidValue($status)) {
throw new InvalidEnumValue((string) $status);
}
$this->status = $status;
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'currency' => $this->currency,
'price' => $this->price,
'status' => $this->status,
'minQuantity' => $this->minQuantity,
'relativeDiscount' => $this->relativeDiscount,
'absoluteDiscount' => $this->absoluteDiscount,
'relativeUnitDiscount' => $this->relativeUnitDiscount,
'absoluteUnitDiscount' => $this->absoluteUnitDiscount,
'promocode' => $this->promocode,
'start' => $this->start,
'end' => $this->end,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Item status enum.
*
* @package Modules\ItemManagement\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class ItemPriceStatus extends Enum
{
public const ACTIVE = 1;
public const INACTIVE = 2;
}

View File

@ -29,6 +29,4 @@ abstract class ItemStatus extends Enum
public const ACTIVE = 1;
public const INACTIVE = 2;
public const BANNED = 4;
}

View File

@ -257,6 +257,25 @@ $CONFIG = [
'root' => '/',
'https' => false,
],
'app' => [
'path' => __DIR__,
'default' => [
'app' => 'Backend',
'id' => 'backend',
'lang' => 'en',
'theme' => 'Backend',
'org' => 1,
],
'domains' => [
'127.0.0.1' => [
'app' => 'Backend',
'id' => 'backend',
'lang' => 'en',
'theme' => 'Backend',
'org' => 1,
],
],
],
'socket' => [
'master' => [
'host' => '127.0.0.1',

View File

@ -68,6 +68,7 @@ trait ApiControllerAttributeTrait
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('name', 'test_attribute');
$request->setData('title', 'EN:1');
$request->setData('language', ISO639x1Enum::_EN);

View File

@ -45,26 +45,6 @@ final class ItemAttributeValueTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->attr->isDefault);
}
/**
* @covers Modules\ItemManagement\Models\ItemAttributeValue
* @group module
*/
public function testLanguageInputOutput() : void
{
$this->attr->setLanguage(ISO639x1Enum::_DE);
self::assertEquals(ISO639x1Enum::_DE, $this->attr->getLanguage());
}
/**
* @covers Modules\ItemManagement\Models\ItemAttributeValue
* @group module
*/
public function testCountryInputOutput() : void
{
$this->attr->setCountry(ISO3166TwoEnum::_DEU);
self::assertEquals(ISO3166TwoEnum::_DEU, $this->attr->getCountry());
}
/**
* @covers Modules\ItemManagement\Models\ItemAttributeValue
* @group module
@ -114,8 +94,6 @@ final class ItemAttributeValueTest extends \PHPUnit\Framework\TestCase
$this->attr->type = 1;
$this->attr->setValue('test');
$this->attr->isDefault = true;
$this->attr->setLanguage(ISO639x1Enum::_DE);
$this->attr->setCountry(ISO3166TwoEnum::_DEU);
self::assertEquals(
[
@ -126,8 +104,6 @@ final class ItemAttributeValueTest extends \PHPUnit\Framework\TestCase
'valueDec' => null,
'valueDat' => null,
'isDefault' => true,
'language' => ISO639x1Enum::_DE,
'country' => ISO3166TwoEnum::_DEU,
],
$this->attr->jsonSerialize()
);