Skip to content

Commit

Permalink
Menu Item input data should match what is mandated by menu.xsd
Browse files Browse the repository at this point in the history
  • Loading branch information
fooman committed Aug 16, 2017
1 parent 45896ba commit c0cd601
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 98 deletions.
16 changes: 8 additions & 8 deletions app/code/Magento/Backend/Model/Menu/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ public function toArray()
{
return [
'parent_id' => $this->_parentId,
'module_name' => $this->_moduleName,
'module' => $this->_moduleName,
'sort_index' => $this->_sortIndex,
'depends_on_config' => $this->_dependsOnConfig,
'dependsOnConfig' => $this->_dependsOnConfig,
'id' => $this->_id,
'resource' => $this->_resource,
'path' => $this->_path,
'action' => $this->_action,
'depends_on_module' => $this->_dependsOnModule,
'tooltip' => $this->_tooltip,
'dependsOnModule' => $this->_dependsOnModule,
'toolTip' => $this->_tooltip,
'title' => $this->_title,
'target' => $this->target,
'sub_menu' => isset($this->_submenu) ? $this->_submenu->toArray() : null
Expand All @@ -491,15 +491,15 @@ public function toArray()
public function populateFromArray(array $data)
{
$this->_parentId = $this->_getArgument($data, 'parent_id');
$this->_moduleName = $this->_getArgument($data, 'module_name', 'Magento_Backend');
$this->_moduleName = $this->_getArgument($data, 'module', 'Magento_Backend');
$this->_sortIndex = $this->_getArgument($data, 'sort_index');
$this->_dependsOnConfig = $this->_getArgument($data, 'depends_on_config');
$this->_dependsOnConfig = $this->_getArgument($data, 'dependsOnConfig');
$this->_id = $this->_getArgument($data, 'id');
$this->_resource = $this->_getArgument($data, 'resource');
$this->_path = $this->_getArgument($data, 'path', '');
$this->_action = $this->_getArgument($data, 'action');
$this->_dependsOnModule = $this->_getArgument($data, 'depends_on_module');
$this->_tooltip = $this->_getArgument($data, 'tooltip', '');
$this->_dependsOnModule = $this->_getArgument($data, 'dependsOnModule');
$this->_tooltip = $this->_getArgument($data, 'toolTip');
$this->_title = $this->_getArgument($data, 'title');
$this->target = $this->_getArgument($data, 'target');
if (isset($data['sub_menu'])) {
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Backend/Test/Unit/Model/Menu/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class ItemTest extends \PHPUnit\Framework\TestCase
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
];

protected function setUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
[
'parent_id' => null,
'module_name' => 'Magento_Backend',
'module' => 'Magento_Backend',
'sort_index' => null,
'depends_on_config' => 'system/config/isEnabled',
'dependsOnConfig' => 'system/config/isEnabled',
'id' => 'item',
'resource' => 'Magento_Config::config',
'path' => '',
'action' => '/system/config',
'depends_on_module' => 'Magento_Backend',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'toolTip' => 'Item tooltip',
'title' => 'Item Title',
'sub_menu' => null,
'target' => null
Expand All @@ -38,43 +38,43 @@
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => '5',
'resource' => null,
'path' => null,
'action' => null,
'depends_on_module' => null,
'tooltip' => null,
'dependsOnModule' => null,
'toolTip' => null,
'title' => null,
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => '5',
'resource' => null,
'path' => '',
'action' => null,
'depends_on_module' => null,
'tooltip' => '',
'dependsOnModule' => null,
'toolTip' => '',
'title' => null,
'sub_menu' => ['submenuArray'],
'target' => null
Expand All @@ -83,51 +83,51 @@
'data with submenu to constructor' => [
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => '5',
'resource' => null,
'path' => null,
'action' => null,
'depends_on_module' => null,
'tooltip' => null,
'dependsOnModule' => null,
'toolTip' => null,
'title' => null,
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => null,
'resource' => null,
'path' => '',
'action' => null,
'depends_on_module' => null,
'tooltip' => '',
'dependsOnModule' => null,
'toolTip' => '',
'title' => null,
'sub_menu' => ['submenuArray'],
'target' => null
Expand Down
64 changes: 32 additions & 32 deletions app/code/Magento/Backend/Test/Unit/Model/_files/menu_item_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
'sub_menu' => null,
],
[
'parent_id' => null,
'module_name' => 'Magento_Backend',
'module' => 'Magento_Backend',
'sort_index' => null,
'depends_on_config' => 'system/config/isEnabled',
'dependsOnConfig' => 'system/config/isEnabled',
'id' => 'item',
'resource' => 'Magento_Config::config',
'path' => '',
'action' => '/system/config',
'depends_on_module' => 'Magento_Backend',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'toolTip' => 'Item tooltip',
'title' => 'Item Title',
'sub_menu' => null,
'target' => null
Expand All @@ -35,85 +35,85 @@
'with submenu' => [
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => '5',
'resource' => null,
'path' => null,
'action' => null,
'depends_on_module' => null,
'tooltip' => null,
'dependsOnModule' => null,
'toolTip' => null,
'title' => null,
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => '5',
'resource' => null,
'path' => null,
'action' => null,
'depends_on_module' => null,
'tooltip' => '',
'dependsOnModule' => null,
'toolTip' => '',
'title' => null,
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
'target' => null
]
],
'small set of data' => [
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
],
[
'parent_id' => '1',
'module_name' => 'Magento_Module1',
'module' => 'Magento_Module1',
'sort_index' => '50',
'depends_on_config' => null,
'dependsOnConfig' => null,
'id' => null,
'resource' => null,
'path' => '',
'action' => null,
'depends_on_module' => null,
'tooltip' => '',
'dependsOnModule' => null,
'toolTip' => '',
'title' => null,
'sub_menu' => [
'id' => 'item',
'title' => 'Item Title',
'action' => '/system/config',
'resource' => 'Magento_Config::config',
'depends_on_module' => 'Magento_Backend',
'depends_on_config' => 'system/config/isEnabled',
'tooltip' => 'Item tooltip',
'dependsOnModule' => 'Magento_Backend',
'dependsOnConfig' => 'system/config/isEnabled',
'toolTip' => 'Item tooltip',
],
'target' => null
]
Expand Down
Loading

0 comments on commit c0cd601

Please sign in to comment.