Skip to content

Commit 8e7e152

Browse files
committed
Merge branch 'port-2752' of github.com:magento-mpi/magento2ce into port-2752
2 parents 261d334 + 0d71827 commit 8e7e152

File tree

5 files changed

+98
-20
lines changed

5 files changed

+98
-20
lines changed

app/code/Magento/Catalog/view/frontend/web/js/product/storage/storage-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define([
4747
* @param {*} data
4848
*/
4949
add: function (data) {
50-
if (!utils.compare(data, this.data()).equal) {
50+
if (!_.isEmpty(data) && !utils.compare(data, this.data()).equal) {
5151
this.data(_.extend(utils.copy(this.data()), data));
5252
}
5353
},

app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ $params = $block->getParams();
6767
'jquery',
6868
'Magento_Checkout/js/model/quote',
6969
'Magento_Checkout/js/action/place-order',
70-
'Magento_Checkout/js/action/redirect-on-success'
70+
'Magento_Checkout/js/action/redirect-on-success',
71+
'Magento_Checkout/js/model/full-screen-loader'
7172
],
72-
function($, quote, placeOrderAction, redirectOnSuccessAction) {
73+
function($, quote, placeOrderAction, redirectOnSuccessAction, fullScreenLoader) {
7374
var parent = window.top;
7475

7576
$(parent).trigger('clearTimeout');
@@ -79,6 +80,12 @@ $params = $block->getParams();
7980
function () {
8081
redirectOnSuccessAction.execute();
8182
}
83+
).fail(
84+
function () {
85+
var parent = window.top;
86+
$(parent).trigger('clearTimeout');
87+
fullScreenLoader.stopLoader();
88+
}
8289
);
8390
}
8491
);

app/code/Magento/Paypal/Controller/Transparent/Response.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Paypal\Controller\Transparent;
77

8+
use Magento\Framework\App\CsrfAwareActionInterface;
89
use Magento\Framework\Registry;
910
use Magento\Framework\App\Action\Context;
1011
use Magento\Framework\View\Result\LayoutFactory;
@@ -16,11 +17,13 @@
1617
use Magento\Paypal\Model\Payflow\Transparent;
1718
use Magento\Sales\Api\PaymentFailuresInterface;
1819
use Magento\Framework\Session\Generic as Session;
20+
use Magento\Framework\App\RequestInterface;
21+
use Magento\Framework\App\Request\InvalidRequestException;
1922

2023
/**
21-
* Class Response
24+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2225
*/
23-
class Response extends \Magento\Framework\App\Action\Action
26+
class Response extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
2427
{
2528
/**
2629
* Core registry
@@ -91,6 +94,23 @@ public function __construct(
9194
$this->paymentFailures = $paymentFailures ?: $this->_objectManager->get(PaymentFailuresInterface::class);
9295
}
9396

97+
/**
98+
* @inheritDoc
99+
*/
100+
public function createCsrfValidationException(
101+
RequestInterface $request
102+
): ?InvalidRequestException {
103+
return null;
104+
}
105+
106+
/**
107+
* @inheritDoc
108+
*/
109+
public function validateForCsrf(RequestInterface $request): ?bool
110+
{
111+
return true;
112+
}
113+
94114
/**
95115
* @return ResultInterface
96116
*/

dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassDeleteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function failedRequestDataProvider(): array
125125
return [
126126
[
127127
'ids' => [],
128-
'constraint' => self::equalTo(['Please select item(s).']),
128+
'constraint' => self::equalTo(['An item needs to be selected. Select and try again.']),
129129
'messageType' => MessageInterface::TYPE_ERROR,
130130
],
131131
[
@@ -135,7 +135,7 @@ public function failedRequestDataProvider(): array
135135
],
136136
[
137137
'ids' => null,
138-
'constraint' => self::equalTo(['Please select item(s).']),
138+
'constraint' => self::equalTo(['An item needs to be selected. Select and try again.']),
139139
'messageType' => MessageInterface::TYPE_ERROR,
140140
]
141141
];

dev/tests/js/jasmine/tests/app/code/Magento/Catalog/frontend/js/product/storage/storage-service.test.js

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,11 @@ define([
1212

1313
var injector = new Squire(),
1414
mocks = {
15-
'Magento_Catalog/js/product/storage/ids-storage': {
16-
name: 'IdsStorage',
17-
initialize: jasmine.createSpy().and.returnValue({})
18-
},
1915
'Magento_Catalog/js/product/storage/data-storage': {},
2016
'Magento_Catalog/js/product/storage/ids-storage-compare': {}
2117
},
22-
obj;
23-
24-
beforeEach(function (done) {
25-
injector.mock(mocks);
26-
injector.require(['Magento_Catalog/js/product/storage/storage-service'], function (insance) {
27-
obj = insance;
28-
done();
29-
});
30-
});
18+
obj,
19+
utils;
3120

3221
afterEach(function () {
3322
try {
@@ -43,6 +32,19 @@ define([
4332
},
4433
storage;
4534

35+
beforeEach(function (done) {
36+
injector.mock(mocks);
37+
injector.require([
38+
'Magento_Catalog/js/product/storage/ids-storage',
39+
'Magento_Catalog/js/product/storage/storage-service',
40+
'mageUtils'
41+
], function (IdsStorage, instance, mageUtils) {
42+
obj = instance;
43+
utils = mageUtils;
44+
done();
45+
});
46+
});
47+
4648
describe('"createStorage" method', function () {
4749
it('create new storage', function () {
4850
obj.processSubscribers = jasmine.createSpy();
@@ -73,5 +75,54 @@ define([
7375
expect(typeof obj.getStorage(config.namespace)).toBe('object');
7476
});
7577
});
78+
describe('"add" method', function () {
79+
var storageValue;
80+
81+
beforeEach(function () {
82+
storage = new obj.createStorage(config);
83+
storageValue = {
84+
'property1': 1
85+
};
86+
87+
storage.set(storageValue);
88+
});
89+
90+
it('method exists', function () {
91+
expect(storage.add).toBeDefined();
92+
expect(typeof storage.add).toEqual('function');
93+
});
94+
95+
it('update value', function () {
96+
spyOn(utils, 'copy').and.callThrough();
97+
expect(storage.get()).toEqual(storageValue);
98+
99+
storageValue = {
100+
'property2': 2
101+
};
102+
103+
storage.add(storageValue);
104+
105+
expect(utils.copy).toHaveBeenCalled();
106+
expect(storage.get()).toEqual(
107+
{
108+
'property1': 1,
109+
'property2': 2
110+
}
111+
);
112+
});
113+
114+
it('add empty value', function () {
115+
spyOn(utils, 'copy').and.callThrough();
116+
117+
storage.add({});
118+
119+
expect(utils.copy).not.toHaveBeenCalled();
120+
expect(storage.get()).toEqual(
121+
{
122+
'property1': 1
123+
}
124+
);
125+
});
126+
});
76127
});
77128
});

0 commit comments

Comments
 (0)