Skip to content

Commit cac9fa8

Browse files
committed
Merge remote-tracking branch 'main-ce/develop' into MAGETWO-60107
2 parents d9d75e8 + bd1655b commit cac9fa8

File tree

22 files changed

+252
-55
lines changed

22 files changed

+252
-55
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ define([
9898
quote.totals.subscribe(function () {
9999
if (self.grandTotalAmount !== quote.totals()['base_grand_total']) {
100100
self.grandTotalAmount = quote.totals()['base_grand_total'];
101-
self.reInitPayPal();
102101
}
103102
});
104103

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
640640

641641
$collection->load();
642642

643+
$collection->addCategoryIds();
643644
$searchResult = $this->searchResultsFactory->create();
644645
$searchResult->setSearchCriteria($searchCriteria);
645646
$searchResult->setItems($collection->getItems());

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ public function testGetList()
715715
->method('process')
716716
->with($searchCriteriaMock, $collectionMock);
717717
$collectionMock->expects($this->once())->method('load');
718+
$collectionMock->expects($this->once())->method('addCategoryIds');
718719
$collectionMock->expects($this->once())->method('getItems')->willReturn([$itemsMock]);
719720
$collectionMock->expects($this->once())->method('getSize')->willReturn(128);
720721
$searchResultsMock = $this->getMock(

app/code/Magento/CheckoutAgreements/view/frontend/web/js/model/agreement-validator.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ define(
1212
function ($) {
1313
'use strict';
1414
var checkoutConfig = window.checkoutConfig,
15-
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};
16-
17-
var agreementsInputPath = '.payment-method._active div.checkout-agreements input';
15+
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},
16+
agreementsInputPath = '.payment-method._active div.checkout-agreements input';
1817

1918
return {
2019
/**
@@ -23,26 +22,11 @@ define(
2322
* @returns {boolean}
2423
*/
2524
validate: function() {
26-
if (!agreementsConfig.isEnabled) {
27-
return true;
28-
}
29-
30-
if ($(agreementsInputPath).length == 0) {
25+
if (!agreementsConfig.isEnabled || $(agreementsInputPath).length == 0) {
3126
return true;
3227
}
3328

34-
return $('#co-payment-form').validate({
35-
errorClass: 'mage-error',
36-
errorElement: 'div',
37-
meta: 'validate',
38-
errorPlacement: function (error, element) {
39-
var errorPlacement = element;
40-
if (element.is(':checkbox') || element.is(':radio')) {
41-
errorPlacement = element.siblings('label').last();
42-
}
43-
errorPlacement.after(error);
44-
}
45-
}).element(agreementsInputPath);
29+
return $.validator.validateSingleElement(agreementsInputPath, {errorElement: 'div'});
4630
}
4731
}
4832
}

app/code/Magento/CheckoutAgreements/view/frontend/web/template/checkout/checkout-agreements.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
<div class="checkout-agreements" data-bind="visible: isVisible">
99
<!-- ko foreach: agreements -->
1010
<!-- ko if: ($parent.isAgreementRequired($data)) -->
11-
<div class="checkout-agreement">
12-
<input type="checkbox"
11+
<div class="checkout-agreement required">
12+
<input type="checkbox" class="required-entry"
1313
data-bind="attr: {
1414
'id': 'agreement_' + agreementId,
1515
'name': 'agreement[' + agreementId + ']',
1616
'value': agreementId
17-
}"
18-
data-validate="{required:true}" />
17+
}"/>
1918
<label data-bind="attr: {'for': 'agreement_' + agreementId}">
2019
<button type="button"
2120
class="action action-show"

app/code/Magento/Cms/Model/ResourceModel/Block/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected function _construct()
4141
{
4242
$this->_init(\Magento\Cms\Model\Block::class, \Magento\Cms\Model\ResourceModel\Block::class);
4343
$this->_map['fields']['store'] = 'store_table.store_id';
44+
$this->_map['fields']['block_id'] = 'main_table.block_id';
4445
}
4546

4647
/**

app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
1212
*
1313
* @var array
1414
*/
15-
protected $_idAttributes = ['/config/zip' => 'countryCode'];
15+
protected $_idAttributes = [
16+
'/config/zip' => 'countryCode',
17+
'/config/zip/codes/code' => 'id',
18+
];
1619

1720
/**
1821
* Construct the FileSystem Reader Class

app/code/Magento/OfflineShipping/etc/adminhtml/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0">
5353
<label>Show Method if Not Applicable</label>
5454
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
55+
<frontend_class>shipping-skip-hide</frontend_class>
5556
</field>
5657
<field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
5758
<label>Displayed Error Message</label>
@@ -146,6 +147,7 @@
146147
<field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0">
147148
<label>Show Method if Not Applicable</label>
148149
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
150+
<frontend_class>shipping-skip-hide</frontend_class>
149151
</field>
150152
<field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
151153
<label>Displayed Error Message</label>

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ class ConfigurableProduct extends FinalPrice implements ConfiguredPriceInterface
2121
*/
2222
public function getValue()
2323
{
24-
$result = 0.;
2524
/** @var \Magento\Wishlist\Model\Item\Option $customOption */
2625
$customOption = $this->getProduct()->getCustomOption('simple_product');
27-
if ($customOption) {
28-
/** @var \Magento\Framework\Pricing\PriceInfoInterface $priceInfo */
29-
$priceInfo = $customOption->getProduct()->getPriceInfo();
30-
$result = $priceInfo->getPrice(self::PRICE_CODE)->getValue();
31-
}
32-
return max(0, $result);
26+
$product = $customOption ? $customOption->getProduct() : $this->getProduct();
27+
$price = $product->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
28+
29+
return max(0, $price);
3330
}
3431

3532
/**

app/code/Magento/Wishlist/Test/Unit/Pricing/ConfiguredPrice/ConfigurableProductTest.php

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,30 @@
55
*/
66
namespace Magento\Wishlist\Test\Unit\Pricing\ConfiguredPrice;
77

8-
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
9-
use Magento\Framework\Pricing\PriceCurrencyInterface;
10-
use Magento\Framework\Pricing\PriceInfoInterface;
11-
use Magento\Framework\Pricing\SaleableInterface;
12-
use Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct;
13-
148
class ConfigurableProductTest extends \PHPUnit_Framework_TestCase
159
{
1610
/**
17-
* @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
11+
* @var \Magento\Framework\Pricing\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
1812
*/
1913
private $saleableItem;
2014

2115
/**
22-
* @var CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
16+
* @var \Magento\Framework\Pricing\Adjustment\CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
2317
*/
2418
private $calculator;
2519

2620
/**
27-
* @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
21+
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
2822
*/
2923
private $priceCurrency;
3024

3125
/**
32-
* @var ConfigurableProduct
26+
* @var \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct
3327
*/
3428
private $model;
3529

3630
/**
37-
* @var PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
31+
* @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
3832
*/
3933
private $priceInfoMock;
4034

@@ -49,17 +43,14 @@ protected function setUp()
4943
'getCustomOption',
5044
])
5145
->getMockForAbstractClass();
52-
$this->saleableItem->expects($this->once())
53-
->method('getPriceInfo')
54-
->willReturn($this->priceInfoMock);
5546

5647
$this->calculator = $this->getMockBuilder(\Magento\Framework\Pricing\Adjustment\CalculatorInterface::class)
5748
->getMockForAbstractClass();
5849

5950
$this->priceCurrency = $this->getMockBuilder(\Magento\Framework\Pricing\PriceCurrencyInterface::class)
6051
->getMockForAbstractClass();
6152

62-
$this->model = new ConfigurableProduct(
53+
$this->model = new \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct(
6354
$this->saleableItem,
6455
null,
6556
$this->calculator,
@@ -82,7 +73,7 @@ public function testGetValue()
8273
->getMock();
8374
$this->priceInfoMock->expects($this->once())
8475
->method('getPrice')
85-
->with(ConfigurableProduct::PRICE_CODE)
76+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
8677
->willReturn($priceMock);
8778

8879
$productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
@@ -109,11 +100,28 @@ public function testGetValue()
109100

110101
public function testGetValueWithNoCustomOption()
111102
{
103+
$priceValue = 100;
104+
105+
$priceMock = $this->getMockBuilder(\Magento\Framework\Pricing\Price\PriceInterface::class)
106+
->getMockForAbstractClass();
107+
$priceMock->expects($this->once())
108+
->method('getValue')
109+
->willReturn($priceValue);
110+
112111
$this->saleableItem->expects($this->once())
113112
->method('getCustomOption')
114113
->with('simple_product')
115114
->willReturn(null);
116115

117-
$this->assertEquals(0, $this->model->getValue());
116+
$this->saleableItem->expects($this->once())
117+
->method('getPriceInfo')
118+
->willReturn($this->priceInfoMock);
119+
120+
$this->priceInfoMock->expects($this->once())
121+
->method('getPrice')
122+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
123+
->willReturn($priceMock);
124+
125+
$this->assertEquals(100, $this->model->getValue());
118126
}
119127
}

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,18 @@ public function testGetList()
713713

714714
$this->assertNotNull($response['items'][0]['sku']);
715715
$this->assertEquals('simple', $response['items'][0]['sku']);
716+
717+
$index = null;
718+
foreach ($response['items'][0]['custom_attributes'] as $key => $customAttribute) {
719+
if ($customAttribute['attribute_code'] == 'category_ids') {
720+
$index = $key;
721+
break;
722+
}
723+
}
724+
$this->assertNotNull($index, 'Category information wasn\'t set');
725+
726+
$expectedResult = (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? ['string' => '2'] : ['2'];
727+
$this->assertEquals($expectedResult, $response['items'][0]['custom_attributes'][$index]['value']);
716728
}
717729

718730
/**

dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithDiscountTest.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,25 @@
3030
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
3131
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
3232
</variation>
33+
<variation name="OnePageCheckoutWithDiscountTestVariation2" summary="Checkout with 100% discount and free shipping if Braintree through PayPal is enabled" ticketId="MAGETWO-59940">
34+
<data name="description" xsi:type="string">Use saved for Braintree credit card on checkout</data>
35+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
36+
<data name="customer/dataset" xsi:type="string">default</data>
37+
<data name="salesRule" xsi:type="string">active_sales_rule_with_fixed_price_discount_coupon</data>
38+
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
39+
<data name="checkoutMethod" xsi:type="string">login</data>
40+
<data name="shipping/shipping_service" xsi:type="string">Free Shipping</data>
41+
<data name="shipping/shipping_method" xsi:type="string">Free</data>
42+
<data name="payment/method" xsi:type="string">free</data>
43+
<data name="prices" xsi:type="array">
44+
<item name="grandTotal" xsi:type="string">0.00</item>
45+
</data>
46+
<data name="configData" xsi:type="string">braintree, braintree_use_vault, freeshipping</data>
47+
<data name="status" xsi:type="string">Pending</data>
48+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
49+
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
50+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
51+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
52+
</variation>
3353
</testCase>
3454
</config>

dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
*/
1515
class AssertGrandTotalOrderReview extends AbstractConstraint
1616
{
17+
/**
18+
* Wait element.
19+
*
20+
* @var string
21+
*/
22+
protected $waitElement = '.loading-mask';
23+
1724
/**
1825
* Assert that Order Grand Total is correct on checkoutOnePage
1926
*
@@ -23,6 +30,7 @@ class AssertGrandTotalOrderReview extends AbstractConstraint
2330
*/
2431
public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal)
2532
{
33+
$checkoutOnepage->getReviewBlock()->waitForElementNotVisible($this->waitElement);
2634
$checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal();
2735

2836
\PHPUnit_Framework_Assert::assertEquals(

dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ public function hoverProductBlock()
164164
$this->_rootElement->find($this->price)->hover();
165165
}
166166

167+
/**
168+
* Returns product price
169+
*
170+
* @param string $currency
171+
* @return string
172+
*/
173+
public function getPrice($currency = '$')
174+
{
175+
$price = $this->_rootElement->find($this->price)->getText();
176+
return str_replace($currency, '', $price);
177+
}
178+
167179
/**
168180
* Get Wish List data for the Product.
169181
*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Wishlist\Test\Constraint;
8+
9+
class AssertProductPriceIsNotZero extends \Magento\Mtf\Constraint\AbstractConstraint
10+
{
11+
/**
12+
* Assert that product price is not zero in default wishlist.
13+
*
14+
* @param \Magento\Cms\Test\Page\CmsIndex $cmsIndex
15+
* @param \Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex
16+
* @param \Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex
17+
* @param \Magento\Mtf\Fixture\InjectableFixture $product
18+
*
19+
* @return void
20+
*/
21+
public function processAssert(
22+
\Magento\Cms\Test\Page\CmsIndex $cmsIndex,
23+
\Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex,
24+
\Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex,
25+
\Magento\Mtf\Fixture\InjectableFixture $product
26+
) {
27+
$cmsIndex->getLinksBlock()->openLink('My Account');
28+
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
29+
$wishlistItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product);
30+
31+
\PHPUnit_Framework_Assert::assertNotEquals(
32+
'0.00',
33+
$wishlistItem->getPrice(),
34+
$product->getName() . ' has zero price on Wish List page.'
35+
);
36+
}
37+
38+
/**
39+
* Returns a string representation of the object.
40+
*
41+
* @return string
42+
*/
43+
public function toString()
44+
{
45+
return 'Product price is not zero in default Wish List.';
46+
}
47+
}

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ public function __prepare(Customer $customer)
4848
*
4949
* @param Customer $customer
5050
* @param string $product
51+
* @param bool $configure
5152
* @return array
5253
*/
53-
public function test(Customer $customer, $product)
54+
public function test(Customer $customer, $product, $configure = true)
5455
{
5556
$product = $this->createProducts($product)[0];
5657

5758
// Steps:
5859
$this->loginCustomer($customer);
59-
$this->addToWishlist([$product], true);
60+
$this->addToWishlist([$product], $configure);
6061

6162
return ['product' => $product];
6263
}

0 commit comments

Comments
 (0)