Skip to content

Commit cf4bf08

Browse files
committed
MAGETWO-52000: [Github][PR]impossible to see what is wrong with cron - unhelpful error message #3189
- merging mainline
2 parents a82fc45 + 42428d5 commit cf4bf08

File tree

176 files changed

+5383
-2473
lines changed

Some content is hidden

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

176 files changed

+5383
-2473
lines changed

.htaccess

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
# Insert filter on all content
102102
###SetOutputFilter DEFLATE
103103
# Insert filter on selected content types only
104-
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
104+
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json image/svg+xml
105105

106106
# Netscape 4.x has some problems...
107107
#BrowserMatch ^Mozilla/4 gzip-only-text/html
@@ -190,6 +190,7 @@
190190

191191
AddDefaultCharset Off
192192
#AddDefaultCharset UTF-8
193+
AddType 'text/html; charset=UTF-8' html
193194

194195
<IfModule mod_expires.c>
195196

@@ -285,3 +286,38 @@
285286
## http://developer.yahoo.com/performance/rules.html#etags
286287

287288
#FileETag none
289+
290+
# ######################################################################
291+
# # INTERNET EXPLORER #
292+
# ######################################################################
293+
294+
# ----------------------------------------------------------------------
295+
# | Document modes |
296+
# ----------------------------------------------------------------------
297+
298+
# Force Internet Explorer 8/9/10 to render pages in the highest mode
299+
# available in the various cases when it may not.
300+
#
301+
# https://hsivonen.fi/doctype/#ie8
302+
#
303+
# (!) Starting with Internet Explorer 11, document modes are deprecated.
304+
# If your business still relies on older web apps and services that were
305+
# designed for older versions of Internet Explorer, you might want to
306+
# consider enabling `Enterprise Mode` throughout your company.
307+
#
308+
# https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode
309+
# http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx
310+
311+
<IfModule mod_headers.c>
312+
313+
Header set X-UA-Compatible "IE=edge"
314+
315+
# `mod_headers` cannot match based on the content-type, however,
316+
# the `X-UA-Compatible` response header should be send only for
317+
# HTML documents and not for the other resources.
318+
319+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
320+
Header unset X-UA-Compatible
321+
</FilesMatch>
322+
323+
</IfModule>

.htaccess.sample

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
# Insert filter on all content
101101
###SetOutputFilter DEFLATE
102102
# Insert filter on selected content types only
103-
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
103+
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json image/svg+xml
104104

105105
# Netscape 4.x has some problems...
106106
#BrowserMatch ^Mozilla/4 gzip-only-text/html
@@ -189,6 +189,7 @@
189189

190190
AddDefaultCharset Off
191191
#AddDefaultCharset UTF-8
192+
AddType 'text/html; charset=UTF-8' html
192193

193194
<IfModule mod_expires.c>
194195

@@ -284,3 +285,38 @@
284285
## http://developer.yahoo.com/performance/rules.html#etags
285286

286287
#FileETag none
288+
289+
# ######################################################################
290+
# # INTERNET EXPLORER #
291+
# ######################################################################
292+
293+
# ----------------------------------------------------------------------
294+
# | Document modes |
295+
# ----------------------------------------------------------------------
296+
297+
# Force Internet Explorer 8/9/10 to render pages in the highest mode
298+
# available in the various cases when it may not.
299+
#
300+
# https://hsivonen.fi/doctype/#ie8
301+
#
302+
# (!) Starting with Internet Explorer 11, document modes are deprecated.
303+
# If your business still relies on older web apps and services that were
304+
# designed for older versions of Internet Explorer, you might want to
305+
# consider enabling `Enterprise Mode` throughout your company.
306+
#
307+
# https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode
308+
# http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx
309+
310+
<IfModule mod_headers.c>
311+
312+
Header set X-UA-Compatible "IE=edge"
313+
314+
# `mod_headers` cannot match based on the content-type, however,
315+
# the `X-UA-Compatible` response header should be send only for
316+
# HTML documents and not for the other resources.
317+
318+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
319+
Header unset X-UA-Compatible
320+
</FilesMatch>
321+
322+
</IfModule>

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
use Magento\Customer\Api\CustomerRepositoryInterface;
99
use Magento\Customer\Api\GroupManagementInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Quote\Api\CartManagementInterface;
1012

1113
/**
1214
* Adminhtml quote session
@@ -79,6 +81,11 @@ class Quote extends \Magento\Framework\Session\SessionManager
7981
*/
8082
protected $quoteFactory;
8183

84+
/**
85+
* @var \Magento\Quote\Api\CartManagementInterface;
86+
*/
87+
private $cartManagement;
88+
8289
/**
8390
* @param \Magento\Framework\App\Request\Http $request
8491
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
@@ -143,15 +150,15 @@ public function __construct(
143150
*/
144151
public function getQuote()
145152
{
153+
$cartManagement = $this->getCartManagement();
154+
146155
if ($this->_quote === null) {
147-
$this->_quote = $this->quoteFactory->create();
148156
if ($this->getStoreId()) {
149157
if (!$this->getQuoteId()) {
150-
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId())
151-
->setIsActive(false)
152-
->setStoreId($this->getStoreId());
153-
$this->quoteRepository->save($this->_quote);
154-
$this->setQuoteId($this->_quote->getId());
158+
$this->setQuoteId($cartManagement->createEmptyCart());
159+
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
160+
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId());
161+
$this->_quote->setIsActive(false);
155162
} else {
156163
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);
157164
$this->_quote->setStoreId($this->getStoreId());
@@ -169,6 +176,18 @@ public function getQuote()
169176
return $this->_quote;
170177
}
171178

179+
/**
180+
* @return CartManagementInterface
181+
* @deprecated
182+
*/
183+
private function getCartManagement()
184+
{
185+
if ($this->cartManagement === null) {
186+
$this->cartManagement = ObjectManager::getInstance()->get(CartManagementInterface::class);
187+
}
188+
return $this->cartManagement;
189+
}
190+
172191
/**
173192
* Retrieve store model object
174193
*

app/code/Magento/Backend/Test/Unit/Model/Session/QuoteTest.php

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
9292
*/
9393
protected $quoteFactoryMock;
9494

95+
/**
96+
* @var \PHPUnit_Framework_MockObject_MockObject
97+
*/
98+
protected $cartManagementMock;
99+
95100
/**
96101
* Set up
97102
*
@@ -197,9 +202,16 @@ protected function setUp()
197202
);
198203

199204
$this->quoteFactoryMock = $this->getMock('\Magento\Quote\Model\QuoteFactory', ['create'], [], '', false);
205+
$this->cartManagementMock = $this->getMock(
206+
\Magento\Quote\Api\CartManagementInterface::class,
207+
[],
208+
[],
209+
'',
210+
false
211+
);
200212

201213
$this->quote = $this->getMock(
202-
'Magento\Backend\Model\Session\Quote',
214+
\Magento\Backend\Model\Session\Quote::class,
203215
['getStoreId', 'getQuoteId', 'setQuoteId', 'hasCustomerId', 'getCustomerId'],
204216
[
205217
'request' => $this->requestMock,
@@ -217,10 +229,12 @@ protected function setUp()
217229
'storeManager' => $this->storeManagerMock,
218230
'groupManagement' => $this->groupManagementMock,
219231
'quoteFactory' => $this->quoteFactoryMock
220-
],
221-
'',
222-
true
232+
]
223233
);
234+
235+
$this->prepareObjectManager([
236+
[\Magento\Quote\Api\CartManagementInterface::class, $this->cartManagementMock]
237+
]);
224238
}
225239

226240
/**
@@ -235,6 +249,8 @@ public function testGetQuoteWithoutQuoteId()
235249
$customerId = 66;
236250
$customerGroupId = 77;
237251

252+
$this->cartManagementMock->expects($this->once())->method('createEmptyCart')->willReturn($quoteId);
253+
238254
$this->quote->expects($this->any())
239255
->method('getQuoteId')
240256
->will($this->returnValue(null));
@@ -271,7 +287,6 @@ public function testGetQuoteWithoutQuoteId()
271287
'setStoreId',
272288
'setCustomerGroupId',
273289
'setIsActive',
274-
'getId',
275290
'assignCustomer',
276291
'setIgnoreOldQty',
277292
'setIsSuperMode',
@@ -281,9 +296,7 @@ public function testGetQuoteWithoutQuoteId()
281296
'',
282297
false
283298
);
284-
$quoteMock->expects($this->once())
285-
->method('setStoreId')
286-
->with($storeId);
299+
$this->quoteRepositoryMock->expects($this->once())->method('get')->willReturn($quoteMock);
287300
$quoteMock->expects($this->once())
288301
->method('setCustomerGroupId')
289302
->with($customerGroupId)
@@ -292,9 +305,6 @@ public function testGetQuoteWithoutQuoteId()
292305
->method('setIsActive')
293306
->with(false)
294307
->will($this->returnSelf());
295-
$quoteMock->expects($this->once())
296-
->method('getId')
297-
->will($this->returnValue($quoteId));
298308
$quoteMock->expects($this->once())
299309
->method('assignCustomer')
300310
->with($dataCustomerMock);
@@ -305,13 +315,6 @@ public function testGetQuoteWithoutQuoteId()
305315
->method('setIsSuperMode')
306316
->with(true);
307317

308-
$this->quoteFactoryMock->expects($this->once())
309-
->method('create')
310-
->will($this->returnValue($quoteMock));
311-
$this->quoteRepositoryMock->expects($this->once())
312-
->method('save')
313-
->with($quoteMock);
314-
315318
$this->assertEquals($quoteMock, $this->quote->getQuote());
316319
}
317320

@@ -380,9 +383,6 @@ public function testGetQuoteWithQuoteId($customerId, $quoteCustomerId, $expected
380383
->method('getCustomerId')
381384
->will($this->returnValue($quoteCustomerId));
382385

383-
$this->quoteFactoryMock->expects($this->once())
384-
->method('create')
385-
->will($this->returnValue($quoteMock));
386386
$this->quoteRepositoryMock->expects($this->once())
387387
->method('get')
388388
->with($quoteId)
@@ -401,4 +401,19 @@ public function getQuoteDataProvider()
401401
'customer ids same' => [66, 66, 'never'],
402402
];
403403
}
404+
405+
/**
406+
* @param array $map
407+
* @deprecated
408+
*/
409+
private function prepareObjectManager($map)
410+
{
411+
$objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface');
412+
$objectManagerMock->expects($this->any())->method('getInstance')->willReturnSelf();
413+
$objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($map));
414+
$reflectionClass = new \ReflectionClass('Magento\Framework\App\ObjectManager');
415+
$reflectionProperty = $reflectionClass->getProperty('_instance');
416+
$reflectionProperty->setAccessible(true);
417+
$reflectionProperty->setValue($objectManagerMock);
418+
}
404419
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<argument name="storage" xsi:type="object">Magento\Backend\Model\Session\Quote\Storage</argument>
150150
</arguments>
151151
</type>
152-
<type name="Magento\Framework\Console\CommandList">
152+
<type name="Magento\Framework\Console\CommandListInterface">
153153
<arguments>
154154
<argument name="commands" xsi:type="array">
155155
<item name="cacheEnableCommand" xsi:type="object">Magento\Backend\Console\Command\CacheEnableCommand</item>

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ define([
2424
* {String}
2525
*/
2626
id: 'co-transparent-form-braintree'
27-
}
27+
},
28+
isValidCardNumber: false
2829
},
2930

3031
/**
@@ -113,11 +114,7 @@ define([
113114
}
114115

115116
if (event.target.fieldKey === 'number' && event.card) {
116-
if (event.isValid) {
117-
self.cardNumber = event.card;
118-
} else {
119-
self.cardNumber = null;
120-
}
117+
self.isValidCardNumber = event.isValid;
121118
self.selectedCardType(
122119
validator.getMageCardType(event.card.type, self.getCcAvailableTypes())
123120
);
@@ -137,7 +134,7 @@ define([
137134

138135
$selector.removeClass(invalidClass);
139136

140-
if (this.selectedCardType() === null) {
137+
if (this.selectedCardType() === null || !this.isValidCardNumber) {
141138
$(this.getSelector('cc_number')).addClass(invalidClass);
142139

143140
return false;

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ define([
180180
};
181181
});
182182

183-
$option.text(template(toTemplate));
183+
$option.html(template(toTemplate));
184184
});
185185
});
186186
},

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ public function afterDelete()
824824
*/
825825
public function __sleep()
826826
{
827+
$this->unsetData('entity_type');
827828
return array_diff(
828829
parent::__sleep(),
829830
['_indexerEavProcessor', '_productFlatIndexerProcessor', '_productFlatIndexerHelper', 'attrLockValidator']

0 commit comments

Comments
 (0)