Skip to content

Commit dc47c06

Browse files
Merge pull request #895 from magento-engcom/develop-prs-isolated
[EngCom] Merge Community Pull Requests: - #8776 - #8772 - #8762 - #8768 - #8758 - #8759 - #8623 - #8695 - #8723 - #8678 - #8711 - #8706
2 parents 0cd23b1 + 01230f3 commit dc47c06

File tree

14 files changed

+102
-37
lines changed

14 files changed

+102
-37
lines changed

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Magento\Catalog\Block\Product\View;
1313

1414
use Magento\Catalog\Model\Product;
15+
use Magento\Framework\Phrase;
1516
use Magento\Framework\Pricing\PriceCurrencyInterface;
1617

1718
class Attributes extends \Magento\Framework\View\Element\Template
@@ -85,8 +86,8 @@ public function getAdditionalData(array $excludeAttr = [])
8586
} elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
8687
$value = $this->priceCurrency->convertAndFormat($value);
8788
}
88-
89-
if (is_string($value) && strlen($value)) {
89+
90+
if ($value instanceof Phrase || (is_string($value) && strlen($value))) {
9091
$data[$attribute->getAttributeCode()] = [
9192
'label' => __($attribute->getStoreLabel()),
9293
'value' => $value,

app/code/Magento/Config/Model/Config/SourceFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan
2626
* Create backend model by name
2727
*
2828
* @param string $modelName
29-
* @return mixed
29+
* @return \Magento\Framework\Option\ArrayInterface
3030
*/
3131
public function create($modelName)
3232
{

app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/CustomerComposite/DataTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testGetNextBunch($entityType, $bunchData, $expectedData)
105105
->getMock();
106106
$jsonDecoderMock->expects($this->once())
107107
->method('decode')
108-
->willReturn(\Zend_Json::decode($bunchData));
108+
->willReturn(json_decode($bunchData, true));
109109
$jsonHelper = $helper->getObject(
110110
\Magento\Framework\Json\Helper\Data::class,
111111
[
@@ -140,7 +140,7 @@ public function getNextBunchDataProvider()
140140
return [
141141
'address entity' => [
142142
'$entityType' => CustomerComposite::COMPONENT_ENTITY_ADDRESS,
143-
'$bunchData' => \Zend_Json::encode(
143+
'$bunchData' => json_encode(
144144
[
145145
[
146146
'_scope' => CustomerComposite::SCOPE_DEFAULT,
@@ -170,7 +170,7 @@ public function getNextBunchDataProvider()
170170
],
171171
'customer entity default scope' => [
172172
'$entityType' => CustomerComposite::COMPONENT_ENTITY_CUSTOMER,
173-
'$bunchData' => \Zend_Json::encode(
173+
'$bunchData' => json_encode(
174174
[
175175
[
176176
'_scope' => CustomerComposite::SCOPE_DEFAULT,
@@ -202,7 +202,7 @@ public function getNextBunchDataProvider()
202202
],
203203
'customer entity address scope' => [
204204
'$entityType' => CustomerComposite::COMPONENT_ENTITY_CUSTOMER,
205-
'$bunchData' => \Zend_Json::encode(
205+
'$bunchData' => json_encode(
206206
[
207207
[
208208
'_scope' => CustomerComposite::SCOPE_ADDRESS,

app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
list($dir, $options) = $this->commands[$key];
8787
$dirName = realpath(BP . '/dev/tests/' . $dir);
8888
chdir($dirName);
89-
$command = 'php '. BP . '/' . $vendorDir . '/phpunit/phpunit/phpunit ' . $options;
89+
$command = PHP_BINARY . ' ' . BP . '/' . $vendorDir . '/phpunit/phpunit/phpunit ' . $options;
9090
$message = $dirName . '> ' . $command;
9191
$output->writeln(['', str_pad("---- {$message} ", 70, '-'), '']);
9292
passthru($command, $returnVal);

app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function synchronize($relativeFileName)
5656
} catch (\Exception $e) {
5757
}
5858
if ($storage->getId()) {
59-
/** @var Write $file */
59+
/** @var \Magento\Framework\Filesystem\File\WriteInterface $file */
6060
$file = $this->mediaDirectory->openFile($relativeFileName, 'w');
6161
try {
6262
$file->lock();

app/code/Magento/Persistent/Observer/SetRememberMeStatusForAjaxLoginObserver.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,27 @@ class SetRememberMeStatusForAjaxLoginObserver implements ObserverInterface
2929
protected $_persistentData = null;
3030

3131
/**
32-
* Constructor
32+
* @var \Magento\Framework\Serialize\Serializer\Json
33+
*/
34+
private $serializer;
35+
36+
/**
37+
* SetRememberMeStatusForAjaxLoginObserver constructor.
3338
*
3439
* @param \Magento\Persistent\Helper\Data $persistentData
3540
* @param \Magento\Persistent\Helper\Session $persistentSession
41+
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
42+
* @throws \RuntimeException
3643
*/
3744
public function __construct(
3845
\Magento\Persistent\Helper\Data $persistentData,
39-
\Magento\Persistent\Helper\Session $persistentSession
46+
\Magento\Persistent\Helper\Session $persistentSession,
47+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
4048
) {
4149
$this->_persistentData = $persistentData;
4250
$this->_persistentSession = $persistentSession;
51+
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
52+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
4353
}
4454

4555
/**
@@ -63,7 +73,7 @@ public function execute(Observer $observer)
6373
$requestData = [];
6474
$content = $request->getContent();
6575
if ($content) {
66-
$requestData = \Zend_Json::decode($content);
76+
$requestData = $this->serializer->unserialize($content);
6777
}
6878
$isRememberMeChecked = empty($requestData['persistent_remember_me']) ? false : true;
6979
$this->_persistentSession->setRememberMeChecked((bool)$isRememberMeChecked);

app/code/Magento/SalesRule/view/frontend/web/js/view/payment/discount.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ define([
1515

1616
var totals = quote.getTotals(),
1717
couponCode = ko.observable(null),
18-
isApplied = ko.observable(couponCode() != null);
18+
isApplied;
1919

2020
if (totals()) {
2121
couponCode(totals()['coupon_code']);
2222
}
23+
isApplied = ko.observable(couponCode() != null);
2324

2425
return Component.extend({
2526
defaults: {

app/code/Magento/Search/view/frontend/web/form-mini.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ define([
122122
* @param {Boolean} isActive
123123
*/
124124
setActiveState: function (isActive) {
125+
this.searchForm.toggleClass('active', isActive);
125126
this.searchLabel.toggleClass('active', isActive);
126127

127128
if (this.isExpandable) {

app/code/Magento/Ui/Component/Filters/Type/Range.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function applyFilter()
5353
*/
5454
protected function applyFilterByType($type, $value)
5555
{
56-
if (!empty($value) && $value !== '0') {
56+
if (is_numeric($value)) {
5757
$filter = $this->filterBuilder->setConditionType($type)
5858
->setField($this->getName())
5959
->setValue($value)

app/code/Magento/Ui/Test/Unit/Component/Filters/Type/RangeTest.php

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,58 @@ public function testGetComponentName()
9797
*
9898
* @param string $name
9999
* @param array $filterData
100-
* @param array|null $expectedCondition
100+
* @param array|null $expectedCalls
101101
* @dataProvider getPrepareDataProvider
102102
* @return void
103103
*/
104-
public function testPrepare($name, $filterData, $expectedCondition)
104+
public function testPrepare($name, $filterData, $expectedCalls)
105105
{
106+
$filter = $this->getMock(
107+
\Magento\Framework\Api\Filter::class,
108+
[],
109+
[],
110+
'',
111+
false,
112+
false
113+
);
114+
$this->filterBuilderMock->expects($this->any())
115+
->method('setConditionType')
116+
->willReturnSelf();
117+
$this->filterBuilderMock->expects($this->any())
118+
->method('setField')
119+
->willReturnSelf();
120+
$this->filterBuilderMock->expects($this->any())
121+
->method('setValue')
122+
->willReturnSelf();
123+
$this->filterBuilderMock->expects($this->any())
124+
->method('create')
125+
->willReturn($filter);
126+
106127
$this->contextMock->expects($this->any())
107128
->method('getNamespace')
108129
->willReturn(Range::NAME);
109130
$this->contextMock->expects($this->any())
110131
->method('addComponentDefinition')
111132
->with(Range::NAME, ['extends' => Range::NAME]);
112133
$this->contextMock->expects($this->any())
113-
->method('getRequestParam')
114-
->with(UiContext::FILTER_VAR)
134+
->method('getFiltersParams')
115135
->willReturn($filterData);
136+
116137
/** @var DataProviderInterface $dataProvider */
117138
$dataProvider = $this->getMockForAbstractClass(
118139
\Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface::class,
119140
[],
120141
'',
121142
false
122143
);
123-
$this->contextMock->expects($this->any())
144+
145+
$this->contextMock->expects($this->atLeastOnce())
124146
->method('getDataProvider')
125147
->willReturn($dataProvider);
126-
if ($expectedCondition !== null) {
127-
$dataProvider->expects($this->any())
128-
->method('addFilter')
129-
->with($expectedCondition, $name);
130-
}
148+
149+
$dataProvider->expects($this->exactly($expectedCalls))
150+
->method('addFilter')
151+
->with($filter);
131152

132153
$range = new Range(
133154
$this->contextMock,
@@ -149,37 +170,67 @@ public function getPrepareDataProvider()
149170
[
150171
'test_date',
151172
['test_date' => ['from' => 0, 'to' => 1]],
152-
['from' => null, 'orig_from' => 0, 'to' => 1],
173+
2
153174
],
154175
[
155176
'test_date',
156177
['test_date' => ['from' => '', 'to' => 2]],
157-
['from' => null, 'orig_from' => '', 'to' => 2],
178+
1
158179
],
159180
[
160181
'test_date',
161182
['test_date' => ['from' => 1, 'to' => '']],
162-
['from' => 1, 'orig_to' => '', 'to' => null],
183+
1
163184
],
164185
[
165186
'test_date',
166187
['test_date' => ['from' => 1, 'to' => 0]],
167-
['from' => 1, 'orig_to' => 0, 'to' => null],
188+
2
168189
],
169190
[
170191
'test_date',
171192
['test_date' => ['from' => 1, 'to' => 2]],
172-
['from' => 1, 'to' => 2],
193+
2
194+
],
195+
[
196+
'test_date',
197+
['test_date' => ['from' => 0, 'to' => 0]],
198+
2
199+
],
200+
[
201+
'test_date',
202+
['test_date' => ['from' => '0', 'to' => '0']],
203+
2
204+
],
205+
[
206+
'test_date',
207+
['test_date' => ['from' => '0.0', 'to' => 1]],
208+
2
173209
],
174210
[
175211
'test_date',
176212
['test_date' => ['from' => '', 'to' => '']],
177-
null,
213+
0
214+
],
215+
[
216+
'test_date',
217+
['test_date' => ['from' => 'a', 'to' => 'b']],
218+
0
219+
],
220+
[
221+
'test_date',
222+
['test_date' => ['from' => '1']],
223+
1
224+
],
225+
[
226+
'test_date',
227+
['test_date' => ['to' => '1']],
228+
1
178229
],
179230
[
180231
'test_date',
181232
['test_date' => []],
182-
null,
233+
0
183234
],
184235
];
185236
}

app/code/Magento/Widget/Model/Config/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function convert($source)
4444
case 'parameters':
4545
/** @var $parameter \DOMNode */
4646
foreach ($widgetSubNode->childNodes as $parameter) {
47-
if ($parameter->nodeName === '#text') {
47+
if ($parameter->nodeName === '#text' || $parameter->nodeName === '#comment') {
4848
continue;
4949
}
5050
$subNodeAttributes = $parameter->attributes;
@@ -57,7 +57,7 @@ public function convert($source)
5757
$widgetArray['supported_containers'] = [];
5858
}
5959
foreach ($widgetSubNode->childNodes as $container) {
60-
if ($container->nodeName === '#text') {
60+
if ($container->nodeName === '#text' || $container->nodeName === '#comment') {
6161
continue;
6262
}
6363
$widgetArray['supported_containers'] = array_merge(

app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<label translate="true">Orders and Returns</label>
1212
<description translate="true">Orders and Returns Search Form</description>
1313
<parameters>
14+
<!-- Comment added to check fix to https://github.com/magento/magento2/issues/3882 -->
1415
<parameter name="title" xsi:type="text" visible="false">
1516
<label translate="true">Anchor Custom Title</label>
1617
</parameter>
@@ -54,6 +55,7 @@
5455
</parameter>
5556
</parameters>
5657
<containers>
58+
<!-- Comment added to check fix to https://github.com/magento/magento2/issues/3882 -->
5759
<container name="left">
5860
<template name="default" value="default_template" />
5961
</container>

lib/internal/Magento/Framework/Code/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function generateClass($className)
112112
$this->tryToLoadSourceClass($className, $generator);
113113
if (!($file = $generator->generate())) {
114114
$errors = $generator->getErrors();
115-
throw new \RuntimeException(implode(' ', $errors));
115+
throw new \RuntimeException(implode(' ', $errors) . ' in [' . $className . ']');
116116
}
117117
if (!$this->definedClasses->isClassLoadableFromMemory($className)) {
118118
$this->_ioObject->includeFile($file);

lib/internal/Magento/Framework/DB/Ddl/Table.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ class Table
4141

4242
// Capable to support long date-time before 1970
4343
const TYPE_TEXT = 'text';
44-
44+
45+
// A real blob, stored as binary inside DB
4546
const TYPE_BLOB = 'blob';
4647

4748
// Used for back compatibility, when query param can't use statement options
4849
const TYPE_VARBINARY = 'varbinary';
4950

50-
// A real blob, stored as binary inside DB
51-
5251
/**
5352
* Default and maximal TEXT and BLOB columns sizes we can support for different DB systems.
5453
*/

0 commit comments

Comments
 (0)