@@ -78,7 +78,10 @@ public function testMenuItemManipulation()
78
78
$ menu ->move ('Magento_Catalog::catalog_products ' , 'Magento_Backend::system2 ' );
79
79
}
80
80
81
- public function testSerializeUnserialize ()
81
+ /**
82
+ * @magentoAppIsolation enabled
83
+ */
84
+ public function testSerialize ()
82
85
{
83
86
/** @var Menu $menu */
84
87
$ menu = $ this ->objectManager ->get (\Magento \Backend \Model \MenuFactory::class)->create ();
@@ -111,9 +114,63 @@ public function testSerializeUnserialize()
111
114
'Magento_Backend::system3 '
112
115
);
113
116
$ serializedString = $ menu ->serialize ();
114
- /** @var Menu $unserializedMenu */
115
- $ unserializedMenu = $ this ->objectManager ->get (\Magento \Backend \Model \MenuFactory::class)->create ();
116
- $ unserializedMenu ->unserialize ($ serializedString );
117
- $ this ->assertEquals ($ menu , $ unserializedMenu );
117
+ $ expected = '[{"parent_id":null,"module_name":"Magento_Backend","sort_index":null,"depends_on_config":null, '
118
+ . '"id":"Magento_Backend::system3","resource":"Magento_Backend::system3","path":"","action":null, '
119
+ . '"depends_on_module":null,"tooltip":"","title":"Extended System", '
120
+ . '"sub_menu":[{"parent_id":null,"module_name":"Magento_Backend","sort_index":null, '
121
+ . '"depends_on_config":null,"id":"Magento_Backend::system3_acl","resource":"Magento_Backend::system3_acl", '
122
+ . '"path":"","action":"admin\/backend\/acl\/index","depends_on_module":null,"tooltip":"","title":"Acl", '
123
+ . '"sub_menu":null}]}] ' ;
124
+ $ this ->assertEquals ($ expected , $ serializedString );
125
+ }
126
+
127
+ /**
128
+ * @magentoAppIsolation enabled
129
+ */
130
+ public function testUnserialize ()
131
+ {
132
+ $ serializedMenu = '[{"parent_id":null,"module_name":"Magento_Backend","sort_index":null, '
133
+ . '"depends_on_config":null,"id":"Magento_Backend::system3","resource":"Magento_Backend::system3", '
134
+ . '"path":"","action":null,"depends_on_module":null,"tooltip":"","title":"Extended System", '
135
+ . '"sub_menu":[{"parent_id":null,"module_name":"Magento_Backend","sort_index":null, '
136
+ . '"depends_on_config":null,"id":"Magento_Backend::system3_acl","resource":"Magento_Backend::system3_acl", '
137
+ . '"path":"","action":"admin\/backend\/acl\/index","depends_on_module":null,"tooltip":"","title":"Acl", '
138
+ . '"sub_menu":null}]}] ' ;
139
+ /** @var Menu $menu */
140
+ $ menu = $ this ->objectManager ->get (\Magento \Backend \Model \MenuFactory::class)->create ();
141
+ $ menu ->unserialize ($ serializedMenu );
142
+ $ expected = [
143
+ [
144
+ 'parent_id ' => null ,
145
+ 'module_name ' => 'Magento_Backend ' ,
146
+ 'sort_index ' => null ,
147
+ 'depends_on_config ' => null ,
148
+ 'id ' => 'Magento_Backend::system3 ' ,
149
+ 'resource ' => 'Magento_Backend::system3 ' ,
150
+ 'path ' => '' ,
151
+ 'action ' => null ,
152
+ 'depends_on_module ' => null ,
153
+ 'tooltip ' => '' ,
154
+ 'title ' => 'Extended System ' ,
155
+ 'sub_menu ' =>
156
+ [
157
+ [
158
+ 'parent_id ' => null ,
159
+ 'module_name ' => 'Magento_Backend ' ,
160
+ 'sort_index ' => null ,
161
+ 'depends_on_config ' => null ,
162
+ 'id ' => 'Magento_Backend::system3_acl ' ,
163
+ 'resource ' => 'Magento_Backend::system3_acl ' ,
164
+ 'path ' => '' ,
165
+ 'action ' => 'admin/backend/acl/index ' ,
166
+ 'depends_on_module ' => null ,
167
+ 'tooltip ' => '' ,
168
+ 'title ' => 'Acl ' ,
169
+ 'sub_menu ' => null ,
170
+ ],
171
+ ],
172
+ ],
173
+ ];
174
+ $ this ->assertEquals ($ expected , $ menu ->toArray ());
118
175
}
119
176
}
0 commit comments