Skip to content

Commit c6bfa0b

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into automated_tests
2 parents d99b428 + 813fad8 commit c6bfa0b

File tree

8 files changed

+695
-680
lines changed

8 files changed

+695
-680
lines changed

app/code/Magento/Quote/Model/Product/Plugin/RemoveQuoteItems.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Quote\Model\Product\Plugin;
77

8+
use Magento\Catalog\Model\ResourceModel\Product as ProductResource;
9+
810
class RemoveQuoteItems
911
{
1012
/**
@@ -21,19 +23,17 @@ public function __construct(\Magento\Quote\Model\Product\QuoteItemsCleanerInterf
2123
}
2224

2325
/**
24-
* @param \Magento\Catalog\Model\ResourceModel\Product $subject
25-
* @param \Closure $proceed
26+
* @param ProductResource $subject
27+
* @param ProductResource $result
2628
* @param \Magento\Catalog\Api\Data\ProductInterface $product
27-
* @return mixed
29+
* @return ProductResource
2830
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
29-
* TODO: reimplement with after plugin
3031
*/
31-
public function aroundDelete(
32-
\Magento\Catalog\Model\ResourceModel\Product $subject,
33-
\Closure $proceed,
32+
public function afterDelete(
33+
ProductResource $subject,
34+
ProductResource $result,
3435
\Magento\Catalog\Api\Data\ProductInterface $product
3536
) {
36-
$result = $proceed($product);
3737
$this->quoteItemsCleaner->execute($product);
3838
return $result;
3939
}

app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/RemoveQuoteItemsTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ protected function setUp()
2323
$this->model = new \Magento\Quote\Model\Product\Plugin\RemoveQuoteItems($this->quoteItemsCleanerMock);
2424
}
2525

26-
public function testAroundDelete()
26+
public function testAfterDelete()
2727
{
2828
$productResourceMock = $this->getMock(\Magento\Catalog\Model\ResourceModel\Product::class, [], [], '', false);
2929
$productMock = $this->getMock(\Magento\Catalog\Api\Data\ProductInterface::class);
30-
$closure = function () use ($productResourceMock) {
31-
return $productResourceMock;
32-
};
3330

3431
$this->quoteItemsCleanerMock->expects($this->once())->method('execute')->with($productMock);
35-
$result = $this->model->aroundDelete($productResourceMock, $closure, $productMock);
32+
$result = $this->model->afterDelete($productResourceMock, $productResourceMock, $productMock);
3633
$this->assertEquals($result, $productResourceMock);
3734
}
3835
}

app/code/Magento/Ui/view/base/web/js/form/element/date.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,38 +167,22 @@ define([
167167
prepareDateTimeFormats: function () {
168168
this.pickerDateTimeFormat = this.options.dateFormat;
169169
this.momentFormat = this.options.dateFormat ?
170-
this.convertToMomentFormat(this.options.dateFormat) : this.momentFormat;
170+
utils.convertToMomentFormat(this.options.dateFormat) : this.momentFormat;
171171

172172
if (this.options.showsTime) {
173173
this.pickerDateTimeFormat += ' ' + this.options.timeFormat;
174174
}
175175

176-
this.pickerDateTimeFormat = utils.normalizeDate(this.pickerDateTimeFormat);
176+
this.pickerDateTimeFormat = utils.convertToMomentFormat(this.pickerDateTimeFormat);
177177

178178
if (this.dateFormat) {
179179
this.inputDateFormat = this.dateFormat;
180180
}
181181

182-
this.inputDateFormat = utils.normalizeDate(this.inputDateFormat);
183-
this.outputDateFormat = utils.normalizeDate(this.outputDateFormat);
182+
this.inputDateFormat = utils.convertToMomentFormat(this.inputDateFormat);
183+
this.outputDateFormat = utils.convertToMomentFormat(this.outputDateFormat);
184184

185185
this.validationParams.dateFormat = this.outputDateFormat;
186-
},
187-
188-
/**
189-
* Converts PHP IntlFormatter format to moment format.
190-
*
191-
* @param {String} format - PHP format
192-
* @returns {String} - moment compatible formatting
193-
*/
194-
convertToMomentFormat: function (format) {
195-
var newFormat;
196-
197-
newFormat = format.replace(/yy|y/gi, 'YYYY'); // replace the year
198-
newFormat = newFormat.replace(/dd|d/g, 'DD'); // replace the date
199-
newFormat = newFormat.replace(/mm|m/gi, 'MM'); //replace the month
200-
201-
return newFormat;
202186
}
203187
});
204188
});

app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ define([
5353
'setDate',
5454
moment(
5555
observable(),
56-
utils.normalizeDate(
56+
utils.convertToMomentFormat(
5757
options.dateFormat + (options.showsTime ? ' ' + options.timeFormat : '')
5858
)
5959
).toDate()

0 commit comments

Comments
 (0)