Skip to content

Commit b169333

Browse files
committed
MAGETWO-69155: Fix coding standard in Magento AdminNotification module #9627
- Merge Pull Request #9627 from dverkade/magento2:Fix_coding_standard_in_Magento-AdminNotification
2 parents 34b0747 + 84a002b commit b169333

File tree

16 files changed

+175
-46
lines changed

16 files changed

+175
-46
lines changed

app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\AdminNotification\Block\Grid\Renderer;
1210

1311
class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
@@ -39,9 +37,8 @@ public function __construct(
3937
*/
4038
public function render(\Magento\Framework\DataObject $row)
4139
{
42-
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __(
43-
'Read Details'
44-
) . '</a>' : '';
40+
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' .
41+
__('Read Details') . '</a>' : '';
4542

4643
$markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl(
4744
'*/*/markAsRead/',

app/code/Magento/AdminNotification/Block/ToolbarEntry.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\AdminNotification\Block;
108

119
/**

app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* AdminNotification Inbox model
119
*
@@ -18,7 +16,7 @@ class Collection extends \Magento\AdminNotification\Model\ResourceModel\Inbox\Co
1816
/**
1917
* Add remove filter
2018
*
21-
* @return \Magento\AdminNotification\Model\ResourceModel\Grid\Collection|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
19+
* @return Collection|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
2220
*/
2321
protected function _initSelect()
2422
{

app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Test class for \Magento\AdminNotification\Block\ToolbarEntry
119
*/
@@ -53,7 +51,8 @@ public function testGetLatestUnreadNotifications()
5351

5452
// 1. Create mocks
5553
$notificationList = $this->getMockBuilder(
56-
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class)
54+
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class
55+
)
5756
->disableOriginalConstructor()
5857
->getMock();
5958

app/code/Magento/Deploy/Console/DeployStaticOptions.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ class DeployStaticOptions
126126
*/
127127
const LANGUAGES_ARGUMENT = 'languages';
128128

129+
/**
130+
* Static content version
131+
*/
132+
const CONTENT_VERSION = 'content-version';
133+
129134
/**
130135
* Deploy static command options list
131136
*
@@ -211,7 +216,14 @@ private function getBasicOptions()
211216
null,
212217
InputOption::VALUE_NONE,
213218
'Create symlinks for the files of those locales, which are passed for deployment, '
214-
. 'but have no customizations'
219+
. 'but have no customizations.'
220+
),
221+
new InputOption(
222+
self::CONTENT_VERSION,
223+
null,
224+
InputArgument::OPTIONAL,
225+
'Custom version of static content can be used if running deployment on multiple nodes '
226+
. 'to ensure that static content version is identical and caching works properly.'
215227
),
216228
new InputArgument(
217229
self::LANGUAGES_ARGUMENT,

app/code/Magento/Deploy/Service/DeployStaticContent.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ public function deploy(array $options)
9696
]
9797
);
9898

99-
$version = (new \DateTime())->getTimestamp();
99+
$version = !empty($options[Options::CONTENT_VERSION]) && is_string($options[Options::CONTENT_VERSION])
100+
? $options[Options::CONTENT_VERSION]
101+
: (new \DateTime())->getTimestamp();
100102
$this->versionStorage->save($version);
101103

102104
$packages = $deployStrategy->deploy($options);

app/code/Magento/Deploy/Test/Unit/Service/DeployStaticContentTest.php

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ protected function setUp()
9696
'',
9797
false
9898
);
99-
$this->versionStorage->expects($this->once())->method('save');
10099

101100
$this->service = new DeployStaticContent(
102101
$this->objectManager,
@@ -107,14 +106,13 @@ protected function setUp()
107106
);
108107
}
109108

110-
public function testDeploy()
109+
/**
110+
* @param array $options
111+
* @param string $expectedContentVersion
112+
* @dataProvider deployDataProvider
113+
*/
114+
public function testDeploy($options, $expectedContentVersion)
111115
{
112-
$options = [
113-
'strategy' => 'compact',
114-
'no-javascript' => false,
115-
'no-html-minify' => false
116-
];
117-
118116
$package = $this->getMock(Package::class, [], [], '', false);
119117
$package->expects($this->exactly(1))->method('isVirtual')->willReturn(false);
120118
$package->expects($this->exactly(3))->method('getArea')->willReturn('area');
@@ -125,7 +123,11 @@ public function testDeploy()
125123
'package' => $package
126124
];
127125

128-
$this->versionStorage->expects($this->once())->method('save');
126+
if ($expectedContentVersion) {
127+
$this->versionStorage->expects($this->once())->method('save')->with($expectedContentVersion);
128+
} else {
129+
$this->versionStorage->expects($this->once())->method('save');
130+
}
129131

130132
$queue = $this->getMockBuilder(Queue::class)
131133
->disableOriginalConstructor()
@@ -193,4 +195,27 @@ public function testDeploy()
193195
$this->service->deploy($options)
194196
);
195197
}
198+
199+
public function deployDataProvider()
200+
{
201+
return [
202+
[
203+
[
204+
'strategy' => 'compact',
205+
'no-javascript' => false,
206+
'no-html-minify' => false
207+
],
208+
null // content version value should not be asserted in this case
209+
],
210+
[
211+
[
212+
'strategy' => 'compact',
213+
'no-javascript' => false,
214+
'no-html-minify' => false,
215+
'content-version' => '123456',
216+
],
217+
'123456'
218+
]
219+
];
220+
}
196221
}

app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator/SimpleType.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ class SimpleType
2828
*/
2929
public function getType($attribute)
3030
{
31-
if (in_array($attribute->getAttributeCode(), $this->anyTypeAttributes)) {
31+
$arrayFrontendInputs = ['multiselect'];
32+
$frontendInput = $attribute->getFrontendInput();
33+
if (in_array($attribute->getAttributeCode(), $this->anyTypeAttributes)
34+
|| in_array($frontendInput, $arrayFrontendInputs)
35+
) {
3236
return TypeProcessor::NORMALIZED_ANY_TYPE;
3337
}
34-
$frontendInput = $attribute->getFrontendInput();
38+
3539
$backendType = $attribute->getBackendType();
3640
$backendTypeMap = [
3741
'static' => TypeProcessor::NORMALIZED_ANY_TYPE,
@@ -41,11 +45,6 @@ public function getType($attribute)
4145
'datetime' => TypeProcessor::NORMALIZED_STRING_TYPE,
4246
'decimal' => TypeProcessor::NORMALIZED_DOUBLE_TYPE,
4347
];
44-
$arrayFrontendInputs = ['multiselect'];
45-
$type = $backendTypeMap[$backendType];
46-
if (in_array($frontendInput, $arrayFrontendInputs)) {
47-
$type .= '[]';
48-
}
49-
return $type;
48+
return $backendTypeMap[$backendType];
5049
}
5150
}

app/code/Magento/Webapi/Controller/Soap/Request/Handler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ protected function _prepareResponseData($data, $serviceClassName, $serviceMethod
157157
} elseif (is_array($data)) {
158158
$dataType = substr($dataType, 0, -2);
159159
foreach ($data as $key => $value) {
160-
if ($value instanceof ExtensibleDataInterface || $value instanceof MetadataObjectInterface) {
160+
if ($value instanceof $dataType
161+
// the following two options are supported for backward compatibility
162+
|| $value instanceof ExtensibleDataInterface
163+
|| $value instanceof MetadataObjectInterface
164+
) {
161165
$result[] = $this->_dataObjectConverter
162166
->convertKeysToCamelCase($this->_dataObjectProcessor->buildOutputDataArray($value, $dataType));
163167
} else {

app/code/Magento/Webapi/Test/Unit/Controller/Soap/Request/HandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public function testCall()
104104
$this->_dataObjectConverter->expects($this->once())
105105
->method('convertStdObjectToArray')
106106
->will($this->returnValue(['field' => 1]));
107+
$this->_methodsMapProcessorMock->method('getMethodReturnType')->willReturn('string');
107108
$operationName = 'soapOperation';
108109
$className = \Magento\Framework\DataObject::class;
109110
$methodName = 'testMethod';

0 commit comments

Comments
 (0)