@@ -52,11 +52,6 @@ class BaseTest extends \Magento\Framework\TestFramework\Unit\BaseTestCase
52
52
*/
53
53
private $ defaultPathMock ;
54
54
55
- /**
56
- * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Router\PathConfigInterface
57
- */
58
- private $ pathConfigMock ;
59
-
60
55
protected function setUp ()
61
56
{
62
57
parent ::setUp ();
@@ -68,7 +63,6 @@ protected function setUp()
68
63
$ this ->actionFactoryMock = $ this ->basicMock (\Magento \Framework \App \ActionFactory::class);
69
64
$ this ->nameBuilderMock = $ this ->basicMock (\Magento \Framework \Code \NameBuilder::class);
70
65
$ this ->defaultPathMock = $ this ->basicMock (\Magento \Framework \App \DefaultPathInterface::class);
71
- $ this ->pathConfigMock = $ this ->basicMock (\Magento \Framework \App \Router \PathConfigInterface::class);
72
66
73
67
// Prepare SUT
74
68
$ mocks = [
@@ -78,7 +72,6 @@ protected function setUp()
78
72
'appState ' => $ this ->appStateMock ,
79
73
'nameBuilder ' => $ this ->nameBuilderMock ,
80
74
'defaultPath ' => $ this ->defaultPathMock ,
81
- 'pathConfigMock ' => $ this ->pathConfigMock ,
82
75
];
83
76
$ this ->model = $ this ->objectManager ->getObject (\Magento \Framework \App \Router \Base::class, $ mocks );
84
77
}
@@ -93,19 +86,17 @@ public function testMatch()
93
86
$ actionClassName = \Magento \Framework \App \Action \Action::class;
94
87
$ moduleName = 'module name ' ;
95
88
$ moduleList = [$ moduleName ];
96
- $ pathInfo = 'path/info/ ' ;
97
- $ defaultPath = 'default/path/ ' ;
89
+ $ paramList = $ moduleFrontName . '/ ' . $ actionPath . '/ ' . $ actionName . '/key/val/key2/val2/ ' ;
98
90
99
91
// Stubs
100
92
$ this ->requestMock ->expects ($ this ->any ())->method ('getModuleName ' )->willReturn ($ moduleFrontName );
101
93
$ this ->requestMock ->expects ($ this ->any ())->method ('getControllerName ' )->willReturn ($ actionPath );
102
94
$ this ->requestMock ->expects ($ this ->any ())->method ('getActionName ' )->willReturn ($ actionName );
103
- $ this ->requestMock ->expects ($ this ->any ())->method ('getPathInfo ' )->willReturn ($ pathInfo );
95
+ $ this ->requestMock ->expects ($ this ->any ())->method ('getPathInfo ' )->willReturn ($ paramList );
104
96
$ this ->routeConfigMock ->expects ($ this ->any ())->method ('getModulesByFrontName ' )->willReturn ($ moduleList );
105
97
$ this ->appStateMock ->expects ($ this ->any ())->method ('isInstalled ' )->willReturn (true );
106
98
$ this ->actionListMock ->expects ($ this ->any ())->method ('get ' )->willReturn ($ actionClassName );
107
99
$ this ->actionFactoryMock ->expects ($ this ->any ())->method ('create ' )->willReturn ($ actionInstance );
108
- $ this ->pathConfigMock ->expects ($ this ->any ())->method ('getDefaultPath ' )->willReturn ($ defaultPath );
109
100
110
101
// Expectations and Test
111
102
$ this ->requestExpects ('setModuleName ' , $ moduleFrontName )
@@ -154,13 +145,15 @@ public function testMatchUseDefaultPath()
154
145
$ actionClassName = \Magento \Framework \App \Action \Action::class;
155
146
$ moduleName = 'module name ' ;
156
147
$ moduleList = [$ moduleName ];
148
+ $ paramList = $ moduleFrontName . '/ ' . $ actionPath . '/ ' . $ actionName . '/key/val/key2/val2/ ' ;
157
149
158
150
// Stubs
159
151
$ defaultReturnMap = [
160
152
['module ' , $ moduleFrontName ],
161
153
['controller ' , $ actionPath ],
162
154
['action ' , $ actionName ],
163
155
];
156
+ $ this ->requestMock ->expects ($ this ->any ())->method ('getPathInfo ' )->willReturn ($ paramList );
164
157
$ this ->defaultPathMock ->expects ($ this ->any ())->method ('getPart ' )->willReturnMap ($ defaultReturnMap );
165
158
$ this ->routeConfigMock ->expects ($ this ->any ())->method ('getModulesByFrontName ' )->willReturn ($ moduleList );
166
159
$ this ->appStateMock ->expects ($ this ->any ())->method ('isInstalled ' )->willReturn (false );
@@ -185,9 +178,11 @@ public function testMatchEmptyModuleList()
185
178
$ actionName = 'action name ' ;
186
179
$ actionClassName = \Magento \Framework \App \Action \Action::class;
187
180
$ emptyModuleList = [];
181
+ $ paramList = $ moduleFrontName . '/ ' . $ actionPath . '/ ' . $ actionName . '/key/val/key2/val2/ ' ;
188
182
189
183
// Stubs
190
184
$ this ->requestMock ->expects ($ this ->any ())->method ('getModuleName ' )->willReturn ($ moduleFrontName );
185
+ $ this ->requestMock ->expects ($ this ->any ())->method ('getPathInfo ' )->willReturn ($ paramList );
191
186
$ this ->routeConfigMock ->expects ($ this ->any ())->method ('getModulesByFrontName ' )->willReturn ($ emptyModuleList );
192
187
$ this ->requestMock ->expects ($ this ->any ())->method ('getControllerName ' )->willReturn ($ actionPath );
193
188
$ this ->requestMock ->expects ($ this ->any ())->method ('getActionName ' )->willReturn ($ actionName );
@@ -209,9 +204,11 @@ public function testMatchEmptyActionInstance()
209
204
$ actionClassName = \Magento \Framework \App \Action \Action::class;
210
205
$ moduleName = 'module name ' ;
211
206
$ moduleList = [$ moduleName ];
207
+ $ paramList = $ moduleFrontName . '/ ' . $ actionPath . '/ ' . $ actionName . '/key/val/key2/val2/ ' ;
212
208
213
209
// Stubs
214
210
$ this ->requestMock ->expects ($ this ->any ())->method ('getModuleName ' )->willReturn ($ moduleFrontName );
211
+ $ this ->requestMock ->expects ($ this ->any ())->method ('getPathInfo ' )->willReturn ($ paramList );
215
212
$ this ->routeConfigMock ->expects ($ this ->any ())->method ('getModulesByFrontName ' )->willReturn ($ moduleList );
216
213
$ this ->requestMock ->expects ($ this ->any ())->method ('getControllerName ' )->willReturn ($ actionPath );
217
214
$ this ->requestMock ->expects ($ this ->any ())->method ('getActionName ' )->willReturn ($ actionName );
0 commit comments