Skip to content

Commit a8942a0

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into bugfix
2 parents b9e0026 + e7d6678 commit a8942a0

File tree

32 files changed

+693
-127
lines changed

32 files changed

+693
-127
lines changed

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,4 @@ Pagination,Pagination
456456
"Anchor Text for Next","Anchor Text for Next"
457457
"Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used.","Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used."
458458
"Theme Name","Theme Name"
459+
"Deployment config file %1 is not writable.","Deployment config file %1 is not writable."
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="catalog_product_to_website_change">
10+
<observer name="catalog_product_to_website_change" instance="Magento\CatalogUrlRewrite\Observer\ProductToWebsiteChangeObserver"/>
11+
</event>
12+
</config>

app/code/Magento/Checkout/CustomerData/DefaultItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ protected function doGetItemData()
7171
'configure_url' => $this->getConfigureUrl(),
7272
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
7373
'product_name' => $this->item->getProduct()->getName(),
74+
'product_sku' => $this->item->getProduct()->getSku(),
7475
'product_url' => $this->getProductUrl(),
7576
'product_has_url' => $this->hasProductUrl(),
7677
'product_price' => $this->checkoutHelper->formatPrice($this->item->getCalculationPrice()),
78+
'product_price_value' => $this->item->getCalculationPrice(),
7779
'product_image' => [
7880
'src' => $imageHelper->getUrl(),
7981
'alt' => $imageHelper->getLabel(),
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Test\Unit\CustomerData;
7+
8+
class DefaultItemTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @var \Magento\Checkout\CustomerData\DefaultItem
12+
*/
13+
protected $model;
14+
15+
/**
16+
* @var \Magento\Catalog\Helper\Image
17+
*/
18+
private $imageHelper;
19+
20+
/**
21+
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
22+
*/
23+
private $configurationPool;
24+
25+
protected function setUp()
26+
{
27+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
28+
$this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class)
29+
->disableOriginalConstructor()
30+
->getMock();
31+
$this->configurationPool = $this->getMockBuilder(\Magento\Catalog\Helper\Product\ConfigurationPool::class)
32+
->setMethods([])
33+
->disableOriginalConstructor()
34+
->getMock();
35+
$checkoutHelper = $this->getMockBuilder(\Magento\Checkout\Helper\Data::class)
36+
->setMethods(['formatPrice'])->disableOriginalConstructor()->getMock();
37+
$checkoutHelper->expects($this->any())->method('formatPrice')->willReturn(5);
38+
$this->model = $objectManager->getObject(
39+
\Magento\Checkout\CustomerData\DefaultItem::class,
40+
[
41+
'imageHelper' => $this->imageHelper,
42+
'configurationPool' => $this->configurationPool,
43+
'checkoutHelper' => $checkoutHelper
44+
]
45+
);
46+
}
47+
48+
public function testGetItemData()
49+
{
50+
$urlModel = $this->getMockBuilder(\Magento\Catalog\Model\Product\Url::class)
51+
->disableOriginalConstructor()
52+
->getMock();
53+
$product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
54+
->setMethods(['getUrlModel', 'isVisibleInSiteVisibility', 'getSku'])
55+
->disableOriginalConstructor()
56+
->getMock();
57+
$product->expects($this->any())->method('getUrlModel')->willReturn($urlModel);
58+
$product->expects($this->any())->method('isVisibleInSiteVisibility')->willReturn(true);
59+
$product->expects($this->any())->method('getSku')->willReturn('simple');
60+
/** @var \Magento\Quote\Model\Quote\Item $item */
61+
$item = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class)
62+
->setMethods(['getProductType', 'getProduct', 'getCalculationPrice'])
63+
->disableOriginalConstructor()
64+
->getMock();
65+
$item->expects($this->any())->method('getProduct')->willReturn($product);
66+
$item->expects($this->any())->method('getProductType')->willReturn('simple');
67+
$item->expects($this->any())->method('getCalculationPrice')->willReturn(5);
68+
69+
$this->imageHelper->expects($this->any())->method('init')->with($product)->willReturnSelf();
70+
$this->imageHelper->expects($this->any())->method('getUrl')->willReturn('url');
71+
$this->imageHelper->expects($this->any())->method('getLabel')->willReturn('label');
72+
$this->imageHelper->expects($this->any())->method('getWidth')->willReturn(100);
73+
$this->imageHelper->expects($this->any())->method('getHeight')->willReturn(100);
74+
$this->configurationPool->expects($this->any())->method('getByProductType')->willReturn($product);
75+
76+
$itemData = $this->model->getItemData($item);
77+
$this->assertArrayHasKey('options', $itemData);
78+
$this->assertArrayHasKey('qty', $itemData);
79+
$this->assertArrayHasKey('item_id', $itemData);
80+
$this->assertArrayHasKey('configure_url', $itemData);
81+
$this->assertArrayHasKey('is_visible_in_site_visibility', $itemData);
82+
$this->assertArrayHasKey('product_type', $itemData);
83+
$this->assertArrayHasKey('product_name', $itemData);
84+
$this->assertArrayHasKey('product_sku', $itemData);
85+
$this->assertArrayHasKey('product_url', $itemData);
86+
$this->assertArrayHasKey('product_has_url', $itemData);
87+
$this->assertArrayHasKey('product_price', $itemData);
88+
$this->assertArrayHasKey('product_price_value', $itemData);
89+
$this->assertArrayHasKey('product_image', $itemData);
90+
$this->assertArrayHasKey('canApplyMsrp', $itemData);
91+
}
92+
}
93+

app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
<input data-bind="attr: {
7575
id: 'cart-item-'+item_id+'-qty',
7676
'data-cart-item': item_id,
77-
'data-item-qty': qty
77+
'data-item-qty': qty,
78+
'data-cart-item-id': product_sku
7879
}, value: qty"
7980
type="number"
8081
size="4"

app/code/Magento/PageCache/etc/varnish3.vcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ sub vcl_recv {
4949
return (pass);
5050
}
5151

52-
# Bypass shopping cart and checkout requests
53-
if (req.url ~ "/checkout") {
52+
# Bypass shopping cart, checkout and search requests
53+
if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
5454
return (pass);
5555
}
5656

app/code/Magento/PageCache/etc/varnish4.vcl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ sub vcl_recv {
4141
return (pass);
4242
}
4343

44-
# Bypass shopping cart and checkout requests
45-
if (req.url ~ "/checkout") {
44+
# Bypass shopping cart, checkout and search requests
45+
if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
4646
return (pass);
4747
}
4848

@@ -136,6 +136,16 @@ sub vcl_backend_response {
136136
set beresp.grace = 1m;
137137
}
138138
}
139+
140+
# If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
141+
if (beresp.ttl <= 0s ||
142+
beresp.http.Surrogate-control ~ "no-store" ||
143+
(!beresp.http.Surrogate-Control && beresp.http.Vary == "*")) {
144+
# Mark as Hit-For-Pass for the next 2 minutes
145+
set beresp.ttl = 120s;
146+
set beresp.uncacheable = true;
147+
}
148+
return (deliver);
139149
}
140150

141151
sub vcl_deliver {

app/code/Magento/Paypal/Model/Payflowpro.php

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@
88
use Magento\Framework\DataObject;
99
use Magento\Framework\Exception\LocalizedException;
1010
use Magento\Payment\Model\InfoInterface;
11+
use Magento\Payment\Model\Method\ConfigInterface;
1112
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
13+
use Magento\Payment\Model\Method\Online\GatewayInterface;
14+
use Magento\Payment\Observer\AbstractDataAssignObserver;
15+
use Magento\Paypal\Model\Config;
1216
use Magento\Paypal\Model\Payflow\Service\Gateway;
1317
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
14-
use Magento\Paypal\Model\Payflow\Transparent;
1518
use Magento\Quote\Model\Quote;
16-
use Magento\Sales\Model\Order\Payment;
17-
use Magento\Payment\Model\Method\Online\GatewayInterface;
18-
use Magento\Payment\Model\Method\ConfigInterface;
19-
use Magento\Paypal\Model\Config;
2019
use Magento\Sales\Model\Order;
20+
use Magento\Sales\Model\Order\Payment;
2121
use Magento\Store\Model\ScopeInterface;
22-
use Magento\Vault\Api\Data\PaymentTokenInterface;
2322

2423
/**
2524
* Payflow Pro payment gateway model
@@ -861,6 +860,36 @@ public function addRequestOrderInfo(DataObject $request, Order $order)
861860
->setComment1($orderIncrementId);
862861
}
863862

863+
/**
864+
* Assign data to info model instance
865+
*
866+
* @param array|DataObject $data
867+
* @return $this
868+
* @throws \Magento\Framework\Exception\LocalizedException
869+
*/
870+
public function assignData(DataObject $data)
871+
{
872+
$this->_eventManager->dispatch(
873+
'payment_method_assign_data_' . $this->getCode(),
874+
[
875+
AbstractDataAssignObserver::METHOD_CODE => $this,
876+
AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
877+
AbstractDataAssignObserver::DATA_CODE => $data
878+
]
879+
);
880+
881+
$this->_eventManager->dispatch(
882+
'payment_method_assign_data',
883+
[
884+
AbstractDataAssignObserver::METHOD_CODE => $this,
885+
AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
886+
AbstractDataAssignObserver::DATA_CODE => $data
887+
]
888+
);
889+
890+
return $this;
891+
}
892+
864893
/**
865894
* @param InfoInterface $payment
866895
* @param string $transactionId

app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
use Magento\Framework\DataObject;
1313
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Framework\Event\ManagerInterface;
1415
use Magento\Payment\Model\Method\ConfigInterface;
1516
use Magento\Paypal\Model\Config;
1617
use Magento\Paypal\Model\Payflowpro;
1718
use Magento\Store\Model\ScopeInterface;
19+
use Magento\Payment\Model\InfoInterface;
1820

1921
/**
2022
* Class PayflowproTest
@@ -54,6 +56,11 @@ class PayflowproTest extends \PHPUnit_Framework_TestCase
5456
*/
5557
protected $scopeConfigMock;
5658

59+
/**
60+
* @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
61+
*/
62+
private $eventManager;
63+
5764
protected function setUp()
5865
{
5966
$configFactoryMock = $this->getMock(
@@ -114,10 +121,13 @@ protected function setUp()
114121
$clientFactory = $this->getMock('Magento\Framework\HTTP\ZendClientFactory', ['create'], [], '', false);
115122
$clientFactory->expects($this->any())->method('create')->will($this->returnValue($client));
116123

124+
$this->eventManager = $this->getMockForAbstractClass(ManagerInterface::class);
125+
117126
$this->helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
118127
$this->payflowpro = $this->helper->getObject(
119128
'Magento\Paypal\Model\Payflowpro',
120129
[
130+
'eventDispatcher' => $this->eventManager,
121131
'configFactory' => $configFactoryMock,
122132
'httpClientFactory' => $clientFactory,
123133
'storeManager' => $this->storeManagerMock,
@@ -498,4 +508,26 @@ public function testPostRequestException()
498508

499509
$this->payflowpro->postRequest($request, $config);
500510
}
511+
512+
/**
513+
* @covers \Magento\Paypal\Model\Payflowpro::assignData
514+
*/
515+
public function testAssignData()
516+
{
517+
$data = [
518+
'cc_type' => 'VI',
519+
'cc_last_4' => 1111,
520+
'cc_exp_month' => 12,
521+
'cc_exp_year' => 2023
522+
];
523+
$dataObject = new DataObject($data);
524+
525+
$infoInstance = $this->getMockForAbstractClass(InfoInterface::class);
526+
$this->payflowpro->setData('info_instance', $infoInstance);
527+
528+
$this->eventManager->expects(static::exactly(2))
529+
->method('dispatch');
530+
531+
$this->payflowpro->assignData($dataObject);
532+
}
501533
}

app/code/Magento/Translation/Model/Inline/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,12 @@ private function _prepareTagAttributesForContent(&$content)
436436
$tagHtml = str_replace($matches[0], '', $tagHtml);
437437
$trAttr = ' ' . $this->_getHtmlAttribute(
438438
self::DATA_TRANSLATE,
439-
'[' . htmlspecialchars($matches[1]) . ',' . join(',', $trArr) . ']'
439+
'[' . htmlspecialchars($matches[1]) . ',' . str_replace("\"", "'", join(',', $trArr)) . ']'
440440
);
441441
} else {
442442
$trAttr = ' ' . $this->_getHtmlAttribute(
443443
self::DATA_TRANSLATE,
444-
'[' . join(',', $trArr) . ']'
444+
'[' . str_replace("\"", "'", join(',', $trArr)) . ']'
445445
);
446446
}
447447
$trAttr = $this->_addTranslateAttribute($trAttr);

0 commit comments

Comments
 (0)