Skip to content

Commit e0f7d23

Browse files
author
Oleksii Korshenko
committed
MAGETWO-56154: Sorted Object List in di.xml
- Merge remote-tracking branch 'origin/develop' into HEAD
2 parents 8be4267 + 37692c8 commit e0f7d23

File tree

485 files changed

+18446
-4229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+18446
-4229
lines changed

.php_cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ return Symfony\CS\Config\Config::create()
3333
'extra_empty_lines',
3434
'include',
3535
'join_function',
36-
'multiline_array_trailing_comma',
3736
'namespace_no_leading_whitespace',
3837
'new_with_braces',
3938
'object_operator',

app/code/Magento/Backend/App/Action/Plugin/MassactionKey.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@
77
*/
88
namespace Magento\Backend\App\Action\Plugin;
99

10+
use Magento\Framework\App\RequestInterface;
11+
use Magento\Backend\App\AbstractAction;
12+
1013
class MassactionKey
1114
{
1215
/**
1316
* Process massaction key
1417
*
15-
* @param \Magento\Backend\App\AbstractAction $subject
16-
* @param callable $proceed
17-
* @param \Magento\Framework\App\RequestInterface $request
18+
* @param AbstractAction $subject
19+
* @param RequestInterface $request
1820
*
19-
* @return mixed
21+
* @return void
2022
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2123
*/
22-
public function aroundDispatch(
23-
\Magento\Backend\App\AbstractAction $subject,
24-
\Closure $proceed,
25-
\Magento\Framework\App\RequestInterface $request
26-
) {
24+
public function beforeDispatch(AbstractAction $subject, RequestInterface $request)
25+
{
2726
$key = $request->getPost('massaction_prepare_key');
2827
if ($key) {
2928
$postData = $request->getPost($key);
3029
$value = is_array($postData) ? $postData : explode(',', $postData);
3130
$request->setPostValue($key, $value ? $value : null);
3231
}
33-
return $proceed($request);
3432
}
3533
}

app/code/Magento/Backend/Test/Unit/App/Action/Plugin/MassactionKeyTest.php

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Backend\Test\Unit\App\Action\Plugin;
77

88
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
use Magento\Backend\App\AbstractAction;
10+
use Magento\Framework\App\RequestInterface;
911

1012
class MassactionKeyTest extends \PHPUnit_Framework_TestCase
1113
{
@@ -15,17 +17,12 @@ class MassactionKeyTest extends \PHPUnit_Framework_TestCase
1517
protected $plugin;
1618

1719
/**
18-
* @var \Closure
19-
*/
20-
protected $closureMock;
21-
22-
/**
23-
* @var \PHPUnit_Framework_MockObject_MockObject
20+
* @var \PHPUnit_Framework_MockObject_MockObject|RequestInterface
2421
*/
2522
protected $requestMock;
2623

2724
/**
28-
* @var \PHPUnit_Framework_MockObject_MockObject
25+
* @var \PHPUnit_Framework_MockObject_MockObject|AbstractAction
2926
*/
3027
protected $subjectMock;
3128

@@ -35,27 +32,32 @@ protected function setUp()
3532
return 'Expected';
3633
};
3734
$this->subjectMock = $this->getMock(\Magento\Backend\App\AbstractAction::class, [], [], '', false);
38-
$this->requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
35+
$this->requestMock = $this->getMockForAbstractClass(
36+
RequestInterface::class,
37+
[],
38+
'',
39+
false,
40+
false,
41+
true,
42+
['getPost', 'setPostValue']
43+
);
3944

4045
$objectManager = new ObjectManager($this);
4146
$this->plugin = $objectManager->getObject(
4247
\Magento\Backend\App\Action\Plugin\MassactionKey::class,
4348
[
4449
'subject' => $this->subjectMock,
45-
'closure' => $this->closureMock,
4650
'request' => $this->requestMock,
4751
]
4852
);
4953
}
5054

5155
/**
52-
* @covers \Magento\Backend\App\Action\Plugin\MassactionKey::aroundDispatch
53-
*
5456
* @param $postData array|string
5557
* @param array $convertedData
56-
* @dataProvider aroundDispatchDataProvider
58+
* @dataProvider beforeDispatchDataProvider
5759
*/
58-
public function testAroundDispatchWhenMassactionPrepareKeyRequestExists($postData, $convertedData)
60+
public function testBeforeDispatchWhenMassactionPrepareKeyRequestExists($postData, $convertedData)
5961
{
6062
$this->requestMock->expects($this->at(0))
6163
->method('getPost')
@@ -69,24 +71,18 @@ public function testAroundDispatchWhenMassactionPrepareKeyRequestExists($postDat
6971
->method('setPostValue')
7072
->with('key', $convertedData);
7173

72-
$this->assertEquals(
73-
'Expected',
74-
$this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
75-
);
74+
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
7675
}
7776

78-
public function aroundDispatchDataProvider()
77+
public function beforeDispatchDataProvider()
7978
{
8079
return [
8180
'post_data_is_array' => [['key'], ['key']],
8281
'post_data_is_string' => ['key, key_two', ['key', ' key_two']]
8382
];
8483
}
8584

86-
/**
87-
* @covers \Magento\Backend\App\Action\Plugin\MassactionKey::aroundDispatch
88-
*/
89-
public function testAroundDispatchWhenMassactionPrepareKeyRequestNotExists()
85+
public function testBeforeDispatchWhenMassactionPrepareKeyRequestNotExists()
9086
{
9187
$this->requestMock->expects($this->once())
9288
->method('getPost')
@@ -95,9 +91,6 @@ public function testAroundDispatchWhenMassactionPrepareKeyRequestNotExists()
9591
$this->requestMock->expects($this->never())
9692
->method('setPostValue');
9793

98-
$this->assertEquals(
99-
'Expected',
100-
$this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
101-
);
94+
$this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
10295
}
10396
}

app/code/Magento/Backend/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
<argument name="backendHelper" xsi:type="object">Magento\Backend\Helper\Data\Proxy</argument>
7272
</arguments>
7373
</type>
74-
<preference for="Magento\Framework\Authorization\RoleLocatorInterface" type="Magento\Backend\Model\Authorization\RoleLocator" />
7574
<preference for="Magento\Framework\Authorization\PolicyInterface" type="Magento\Framework\Authorization\Policy\Acl"/>
7675
<preference for="Magento\Framework\Acl\AclResource\ProviderInterface" type="Magento\Framework\Acl\AclResource\Provider"/>
7776
<type name="Magento\Framework\Acl\AclResource\Config\Reader\Filesystem">

0 commit comments

Comments
 (0)