From 9a8e6baf09b7e6bd9b5951ee459cb334c72ceb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Preu=C3=9F?= Date: Sat, 2 Jul 2016 19:08:31 +0200 Subject: [PATCH 1/3] Fix problem with too strict xml validation It was possible to have model definitions that were not parsable in the xml because it validated the xsd specificatons. There was no Problem in adding those Models and use them but not with that .xsd file. --- app/code/Magento/ImportExport/etc/export.xsd | 4 ++-- app/code/Magento/ImportExport/etc/import.xsd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/ImportExport/etc/export.xsd b/app/code/Magento/ImportExport/etc/export.xsd index c7316873d8998..c3f2456d8fefe 100644 --- a/app/code/Magento/ImportExport/etc/export.xsd +++ b/app/code/Magento/ImportExport/etc/export.xsd @@ -71,11 +71,11 @@ - Model name can contain only [A-Za-z_\\\\]. + Model name can contain only [A-Za-z_0-9\\\\]. - + diff --git a/app/code/Magento/ImportExport/etc/import.xsd b/app/code/Magento/ImportExport/etc/import.xsd index 2d6ab40c3c895..5aba1a69fb21f 100644 --- a/app/code/Magento/ImportExport/etc/import.xsd +++ b/app/code/Magento/ImportExport/etc/import.xsd @@ -61,11 +61,11 @@ - Model name can contain only [A-Za-z_\\\\]. + Model name can contain only [A-Za-z_0-9\\\\]. - + From be8750eb59ef238f1cde05de541505f56eb25654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Preu=C3=9F?= Date: Sat, 2 Jul 2016 21:34:35 +0200 Subject: [PATCH 2/3] Fix failing tests to new xsd validation I do not know if those make sense now, but at least the look like it could be ok. --- .../Config/_files/invalidExportXmlArray.php | 16 ++++++++-------- .../_files/invalidImportMergedXmlArray.php | 16 ++++++++-------- .../Config/_files/invalidImportXmlArray.php | 18 +++++++++--------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportXmlArray.php index 707bb6932569c..b87481be98f11 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportXmlArray.php @@ -21,16 +21,16 @@ ], 'attributes_with_type_modelName_and_invalid_value' => [ '' - . ' ', + . 'entityAttributeFilterType="model_one"/>' + . ' ', [ - "Element 'entityType', attribute 'model': [facet 'pattern'] The value '1' is not accepted by the " . - "pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'entityType', attribute 'model': '1' is not a valid value of the atomic type" . + "Element 'entityType', attribute 'model': [facet 'pattern'] The value '-' is not accepted by the " . + "pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'entityType', attribute 'model': '-' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n", - "Element 'fileFormat', attribute 'model': [facet 'pattern'] The value 'model1' is not " . - "accepted by the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'fileFormat', attribute 'model': 'model1' is not a valid " . + "Element 'fileFormat', attribute 'model': [facet 'pattern'] The value 'model-1' is not " . + "accepted by the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'fileFormat', attribute 'model': 'model-1' is not a valid " . "value of the atomic type 'modelName'.\nLine: 1\n" ], ], diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php index f63163d5f5f6b..c3b61c0697676 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php @@ -26,22 +26,22 @@ ["Element 'entity', attribute 'notallowed': The attribute 'notallowed' is not allowed.\nLine: 1\n"], ], 'entity_model_with_invalid_value' => [ - '', [ - "Element 'entity', attribute 'model': [facet 'pattern'] The value 'afwer34' is not " . - "accepted by the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'entity', attribute 'model': 'afwer34' is not a valid value of the atomic type" . + "Element 'entity', attribute 'model': [facet 'pattern'] The value 'afwer-blam' is not " . + "accepted by the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'entity', attribute 'model': 'afwer-blam' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n" ], ], 'entity_behaviorModel_with_invalid_value' => [ - '' . + '' . '', [ - "Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '666' is not accepted by " . - "the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'entity', attribute 'behaviorModel': '666' is not a valid value of the atomic type" . + "Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '6-66' is not accepted by " . + "the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'entity', attribute 'behaviorModel': '6-66' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n" ], ] diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportXmlArray.php index e68335b48f6e2..24edebbafb7c9 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportXmlArray.php @@ -16,11 +16,11 @@ ["Element 'entity': The attribute 'name' is required but missing.\nLine: 1\n"], ], 'entity_with_invalid_model_value' => [ - '', + '', [ - "Element 'entity', attribute 'model': [facet 'pattern'] The value '12345' is not accepted by " . - "the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'entity', attribute 'model': '12345' is not a valid value of the atomic type" . + "Element 'entity', attribute 'model': [facet 'pattern'] The value '123-45' is not accepted by " . + "the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'entity', attribute 'model': '123-45' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n" ], ], @@ -28,7 +28,7 @@ '', [ "Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '=--09' is not " . - "accepted by the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", + "accepted by the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", "Element 'entity', attribute 'behaviorModel': '=--09' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n" ], @@ -46,11 +46,11 @@ ["Element 'entityType': The attribute 'model' is required but missing.\nLine: 1\n"], ], 'entitytype_with_invalid_model_attribute_value' => [ - '', + '', [ - "Element 'entityType', attribute 'model': [facet 'pattern'] The value 'test1' is not " . - "accepted by the pattern '[A-Za-z_\\\\\\\\]+'.\nLine: 1\n", - "Element 'entityType', attribute 'model': 'test1' is not a valid value of the atomic type" . + "Element 'entityType', attribute 'model': [facet 'pattern'] The value 'test-1' is not " . + "accepted by the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n", + "Element 'entityType', attribute 'model': 'test-1' is not a valid value of the atomic type" . " 'modelName'.\nLine: 1\n" ], ], From 9e2217926194f81684a0d833c3eed086492ec0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Preu=C3=9F?= Date: Tue, 5 Jul 2016 21:05:34 +0200 Subject: [PATCH 3/3] Fix line length to be compliant with static rules --- .../Import/Config/_files/invalidImportMergedXmlArray.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php index c3b61c0697676..4ab68faff439d 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php @@ -36,8 +36,8 @@ ], ], 'entity_behaviorModel_with_invalid_value' => [ - '' . - '', + '', [ "Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '6-66' is not accepted by " . "the pattern '[A-Za-z_0-9\\\\\\\\]+'.\nLine: 1\n",