Skip to content

Commit 95ff068

Browse files
committed
REPO-66: [EQP][Sniffs Consolidation] Deliver Magento Coding Standard to magento2ce
- stabilization
1 parent 147d11d commit 95ff068

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lib/internal/Magento/Framework/App/Test/Unit/Router/BaseTest.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ class BaseTest extends \Magento\Framework\TestFramework\Unit\BaseTestCase
5252
*/
5353
private $defaultPathMock;
5454

55-
/**
56-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Router\PathConfigInterface
57-
*/
58-
private $pathConfigMock;
59-
6055
protected function setUp()
6156
{
6257
parent::setUp();
@@ -68,7 +63,6 @@ protected function setUp()
6863
$this->actionFactoryMock = $this->basicMock(\Magento\Framework\App\ActionFactory::class);
6964
$this->nameBuilderMock = $this->basicMock(\Magento\Framework\Code\NameBuilder::class);
7065
$this->defaultPathMock = $this->basicMock(\Magento\Framework\App\DefaultPathInterface::class);
71-
$this->pathConfigMock = $this->basicMock(\Magento\Framework\App\Router\PathConfigInterface::class);
7266

7367
// Prepare SUT
7468
$mocks = [
@@ -78,7 +72,6 @@ protected function setUp()
7872
'appState' => $this->appStateMock,
7973
'nameBuilder' => $this->nameBuilderMock,
8074
'defaultPath' => $this->defaultPathMock,
81-
'pathConfigMock' => $this->pathConfigMock,
8275
];
8376
$this->model = $this->objectManager->getObject(\Magento\Framework\App\Router\Base::class, $mocks);
8477
}
@@ -93,19 +86,17 @@ public function testMatch()
9386
$actionClassName = \Magento\Framework\App\Action\Action::class;
9487
$moduleName = 'module name';
9588
$moduleList = [$moduleName];
96-
$pathInfo = 'path/info/';
97-
$defaultPath = 'default/path/';
89+
$paramList = $moduleFrontName . '/' . $actionPath . '/' . $actionName . '/key/val/key2/val2/';
9890

9991
// Stubs
10092
$this->requestMock->expects($this->any())->method('getModuleName')->willReturn($moduleFrontName);
10193
$this->requestMock->expects($this->any())->method('getControllerName')->willReturn($actionPath);
10294
$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);
10496
$this->routeConfigMock->expects($this->any())->method('getModulesByFrontName')->willReturn($moduleList);
10597
$this->appStateMock->expects($this->any())->method('isInstalled')->willReturn(true);
10698
$this->actionListMock->expects($this->any())->method('get')->willReturn($actionClassName);
10799
$this->actionFactoryMock->expects($this->any())->method('create')->willReturn($actionInstance);
108-
$this->pathConfigMock->expects($this->any())->method('getDefaultPath')->willReturn($defaultPath);
109100

110101
// Expectations and Test
111102
$this->requestExpects('setModuleName', $moduleFrontName)
@@ -154,13 +145,15 @@ public function testMatchUseDefaultPath()
154145
$actionClassName = \Magento\Framework\App\Action\Action::class;
155146
$moduleName = 'module name';
156147
$moduleList = [$moduleName];
148+
$paramList = $moduleFrontName . '/' . $actionPath . '/' . $actionName . '/key/val/key2/val2/';
157149

158150
// Stubs
159151
$defaultReturnMap = [
160152
['module', $moduleFrontName],
161153
['controller', $actionPath],
162154
['action', $actionName],
163155
];
156+
$this->requestMock->expects($this->any())->method('getPathInfo')->willReturn($paramList);
164157
$this->defaultPathMock->expects($this->any())->method('getPart')->willReturnMap($defaultReturnMap);
165158
$this->routeConfigMock->expects($this->any())->method('getModulesByFrontName')->willReturn($moduleList);
166159
$this->appStateMock->expects($this->any())->method('isInstalled')->willReturn(false);
@@ -185,9 +178,11 @@ public function testMatchEmptyModuleList()
185178
$actionName = 'action name';
186179
$actionClassName = \Magento\Framework\App\Action\Action::class;
187180
$emptyModuleList = [];
181+
$paramList = $moduleFrontName . '/' . $actionPath . '/' . $actionName . '/key/val/key2/val2/';
188182

189183
// Stubs
190184
$this->requestMock->expects($this->any())->method('getModuleName')->willReturn($moduleFrontName);
185+
$this->requestMock->expects($this->any())->method('getPathInfo')->willReturn($paramList);
191186
$this->routeConfigMock->expects($this->any())->method('getModulesByFrontName')->willReturn($emptyModuleList);
192187
$this->requestMock->expects($this->any())->method('getControllerName')->willReturn($actionPath);
193188
$this->requestMock->expects($this->any())->method('getActionName')->willReturn($actionName);
@@ -209,9 +204,11 @@ public function testMatchEmptyActionInstance()
209204
$actionClassName = \Magento\Framework\App\Action\Action::class;
210205
$moduleName = 'module name';
211206
$moduleList = [$moduleName];
207+
$paramList = $moduleFrontName . '/' . $actionPath . '/' . $actionName . '/key/val/key2/val2/';
212208

213209
// Stubs
214210
$this->requestMock->expects($this->any())->method('getModuleName')->willReturn($moduleFrontName);
211+
$this->requestMock->expects($this->any())->method('getPathInfo')->willReturn($paramList);
215212
$this->routeConfigMock->expects($this->any())->method('getModulesByFrontName')->willReturn($moduleList);
216213
$this->requestMock->expects($this->any())->method('getControllerName')->willReturn($actionPath);
217214
$this->requestMock->expects($this->any())->method('getActionName')->willReturn($actionName);

lib/internal/Magento/Framework/Data/Collection/Filesystem.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,14 +688,17 @@ public function getAllIds()
688688
* Callback method for 'like' fancy filter.
689689
*
690690
* @param string $field
691-
* @param string $filterValue
691+
* @param mixed $filterValue
692692
* @param array $row
693693
* @return bool
694694
* @see addFieldToFilter()
695695
* @see addCallbackFilter()
696696
*/
697-
public function filterCallbackLike(string $field, string $filterValue, array $row) : bool
697+
public function filterCallbackLike($field, $filterValue, $row)
698698
{
699+
// Forced to do this in order to keep backward compatibility for @api class.
700+
// Strict typing must be added to this method next major release.
701+
$filterValue = (string)$filterValue;
699702
$filterValue = trim(stripslashes($filterValue), '\'');
700703
$filterValue = trim($filterValue, '%');
701704
$filterValueRegex = '(.*?)' . preg_quote($filterValue, '/') . '(.*?)';

0 commit comments

Comments
 (0)