Skip to content

Commit 8036e29

Browse files
committed
Merge remote-tracking branch 'upstream/2.3-develop' into project_pepe
2 parents 0f91a9d + f35c6eb commit 8036e29

File tree

42 files changed

+1079
-123
lines changed

Some content is hidden

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

42 files changed

+1079
-123
lines changed

app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Catalog\Model\Product;
99
use Magento\Catalog\Model\Product\Type;
1010

11+
/**
12+
* Provides duplicating bundle options and selections
13+
*/
1114
class Bundle implements \Magento\Catalog\Model\Product\CopyConstructorInterface
1215
{
1316
/**
@@ -27,7 +30,17 @@ public function build(Product $product, Product $duplicate)
2730
$bundleOptions = $product->getExtensionAttributes()->getBundleProductOptions() ?: [];
2831
$duplicatedBundleOptions = [];
2932
foreach ($bundleOptions as $key => $bundleOption) {
30-
$duplicatedBundleOptions[$key] = clone $bundleOption;
33+
$duplicatedBundleOption = clone $bundleOption;
34+
/**
35+
* Set option and selection ids to 'null' in order to create new option(selection) for duplicated product,
36+
* but not modifying existing one, which led to lost of option(selection) in original product.
37+
*/
38+
$productLinks = $duplicatedBundleOption->getProductLinks() ?: [];
39+
foreach ($productLinks as $productLink) {
40+
$productLink->setSelectionId(null);
41+
}
42+
$duplicatedBundleOption->setOptionId(null);
43+
$duplicatedBundleOptions[$key] = $duplicatedBundleOption;
3144
}
3245
$duplicate->getExtensionAttributes()->setBundleProductOptions($duplicatedBundleOptions);
3346
}

app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Bundle\Test\Unit\Model\Product\CopyConstructor;
77

88
use Magento\Bundle\Api\Data\BundleOptionInterface;
9+
use Magento\Bundle\Model\Link;
910
use Magento\Bundle\Model\Product\CopyConstructor\Bundle;
1011
use Magento\Catalog\Api\Data\ProductExtensionInterface;
1112
use Magento\Catalog\Model\Product;
@@ -45,6 +46,7 @@ public function testBuildNegative()
4546
*/
4647
public function testBuildPositive()
4748
{
49+
/** @var Product|\PHPUnit_Framework_MockObject_MockObject $product */
4850
$product = $this->getMockBuilder(Product::class)
4951
->disableOriginalConstructor()
5052
->getMock();
@@ -60,18 +62,42 @@ public function testBuildPositive()
6062
->method('getExtensionAttributes')
6163
->willReturn($extensionAttributesProduct);
6264

65+
$productLink = $this->getMockBuilder(Link::class)
66+
->setMethods(['setSelectionId'])
67+
->disableOriginalConstructor()
68+
->getMock();
69+
$productLink->expects($this->exactly(2))
70+
->method('setSelectionId')
71+
->with($this->identicalTo(null));
72+
$firstOption = $this->getMockBuilder(BundleOptionInterface::class)
73+
->setMethods(['getProductLinks'])
74+
->disableOriginalConstructor()
75+
->getMockForAbstractClass();
76+
$firstOption->expects($this->once())
77+
->method('getProductLinks')
78+
->willReturn([$productLink]);
79+
$firstOption->expects($this->once())
80+
->method('setOptionId')
81+
->with($this->identicalTo(null));
82+
$secondOption = $this->getMockBuilder(BundleOptionInterface::class)
83+
->setMethods(['getProductLinks'])
84+
->disableOriginalConstructor()
85+
->getMockForAbstractClass();
86+
$secondOption->expects($this->once())
87+
->method('getProductLinks')
88+
->willReturn([$productLink]);
89+
$secondOption->expects($this->once())
90+
->method('setOptionId')
91+
->with($this->identicalTo(null));
6392
$bundleOptions = [
64-
$this->getMockBuilder(BundleOptionInterface::class)
65-
->disableOriginalConstructor()
66-
->getMockForAbstractClass(),
67-
$this->getMockBuilder(BundleOptionInterface::class)
68-
->disableOriginalConstructor()
69-
->getMockForAbstractClass()
93+
$firstOption,
94+
$secondOption
7095
];
7196
$extensionAttributesProduct->expects($this->once())
7297
->method('getBundleProductOptions')
7398
->willReturn($bundleOptions);
7499

100+
/** @var Product|\PHPUnit_Framework_MockObject_MockObject $duplicate */
75101
$duplicate = $this->getMockBuilder(Product::class)
76102
->disableOriginalConstructor()
77103
->getMock();

app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,63 @@
66
*/
77
namespace Magento\Catalog\Controller\Adminhtml\Product\Set;
88

9-
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
9+
use Magento\Framework\Registry;
10+
use Magento\Backend\App\Action\Context;
11+
use Magento\Framework\App\ObjectManager;
12+
use Magento\Backend\Model\View\Result\Page;
13+
use Magento\Framework\View\Result\PageFactory;
14+
use Magento\Framework\Controller\ResultInterface;
15+
use Magento\Eav\Api\AttributeSetRepositoryInterface;
16+
use Magento\Catalog\Controller\Adminhtml\Product\Set;
17+
use Magento\Framework\Exception\NoSuchEntityException;
18+
use Magento\Framework\App\Action\HttpGetActionInterface;
1019

11-
class Edit extends \Magento\Catalog\Controller\Adminhtml\Product\Set implements HttpGetActionInterface
20+
/**
21+
* Edit attribute set controller.
22+
*/
23+
class Edit extends Set implements HttpGetActionInterface
1224
{
1325
/**
14-
* @var \Magento\Framework\View\Result\PageFactory
26+
* @var PageFactory
1527
*/
1628
protected $resultPageFactory;
1729

1830
/**
19-
* @param \Magento\Backend\App\Action\Context $context
20-
* @param \Magento\Framework\Registry $coreRegistry
21-
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
31+
* @var AttributeSetRepositoryInterface
32+
*/
33+
private $attributeSetRepository;
34+
35+
/**
36+
* @param Context $context
37+
* @param Registry $coreRegistry
38+
* @param PageFactory $resultPageFactory
39+
* @param AttributeSetRepositoryInterface $attributeSetRepository
2240
*/
2341
public function __construct(
24-
\Magento\Backend\App\Action\Context $context,
25-
\Magento\Framework\Registry $coreRegistry,
26-
\Magento\Framework\View\Result\PageFactory $resultPageFactory
42+
Context $context,
43+
Registry $coreRegistry,
44+
PageFactory $resultPageFactory,
45+
AttributeSetRepositoryInterface $attributeSetRepository = null
2746
) {
2847
parent::__construct($context, $coreRegistry);
2948
$this->resultPageFactory = $resultPageFactory;
49+
$this->attributeSetRepository = $attributeSetRepository ?:
50+
ObjectManager::getInstance()->get(AttributeSetRepositoryInterface::class);
3051
}
3152

3253
/**
33-
* @return \Magento\Backend\Model\View\Result\Page
54+
* @inheritdoc
3455
*/
3556
public function execute()
3657
{
3758
$this->_setTypeId();
38-
$attributeSet = $this->_objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class)
39-
->load($this->getRequest()->getParam('id'));
40-
59+
$attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id'));
4160
if (!$attributeSet->getId()) {
4261
return $this->resultRedirectFactory->create()->setPath('catalog/*/index');
4362
}
44-
4563
$this->_coreRegistry->register('current_attribute_set', $attributeSet);
4664

47-
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
65+
/** @var Page $resultPage */
4866
$resultPage = $this->resultPageFactory->create();
4967
$resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets');
5068
$resultPage->getConfig()->getTitle()->prepend(__('Attribute Sets'));

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
7272
</strong>
7373
<?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
7474
<?= /* @noEscape */ $block->getProductPrice($_product) ?>
75-
<?= $block->getProductDetailsHtml($_product) ?>
75+
<?php if ($_product->isAvailable()) :?>
76+
<?= $block->getProductDetailsHtml($_product) ?>
77+
<?php endif; ?>
7678

7779
<div class="product-item-inner">
7880
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>>

app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ public function __construct(
2929
}
3030

3131
/**
32+
* Get breadcrumbs data
33+
*
3234
* @param string $categoryPath
3335
* @return array
36+
* @throws \Magento\Framework\Exception\LocalizedException
3437
*/
3538
public function getData(string $categoryPath): array
3639
{
@@ -41,7 +44,7 @@ public function getData(string $categoryPath): array
4144

4245
if (count($parentCategoryIds)) {
4346
$collection = $this->collectionFactory->create();
44-
$collection->addAttributeToSelect(['name', 'url_key']);
47+
$collection->addAttributeToSelect(['name', 'url_key', 'url_path']);
4548
$collection->addAttributeToFilter('entity_id', $parentCategoryIds);
4649

4750
foreach ($collection as $category) {
@@ -50,6 +53,7 @@ public function getData(string $categoryPath): array
5053
'category_name' => $category->getName(),
5154
'category_level' => $category->getLevel(),
5255
'category_url_key' => $category->getUrlKey(),
56+
'category_url_path' => $category->getUrlPath(),
5357
];
5458
}
5559
}

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ type Breadcrumb @doc(description: "Breadcrumb item."){
223223
category_name: String @doc(description: "Category name.")
224224
category_level: Int @doc(description: "Category level.")
225225
category_url_key: String @doc(description: "Category URL key.")
226+
category_url_path: String @doc(description: "Category URL path.")
226227
}
227228

228229
type CustomizableRadioOption implements CustomizableOptionInterface @doc(description: "CustomizableRadioOption contains information about a set of radio buttons that are defined as part of a customizable option.") {

app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@
5757
<scrollToTopOfPage stepKey="scrollToTop"/>
5858
<waitForPageLoad stepKey="waitForApplied"/>
5959
</actionGroup>
60-
60+
<actionGroup name="AdminCreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule">
61+
<remove keyForRemoval="selectSite"/>
62+
<selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/>
63+
</actionGroup>
6164
<actionGroup name="CreateCatalogPriceRuleViaTheUi">
6265
<arguments>
6366
<argument name="catalogRule" defaultValue="_defaultCatalogRule"/>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<fillField selector="{{CheckoutPaymentSection.guestPostcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
2929
<fillField selector="{{CheckoutPaymentSection.guestTelephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
3030
</actionGroup>
31+
<actionGroup name="StorefrontCheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup">
32+
<remove keyForRemoval="enterEmail"/>
33+
<remove keyForRemoval="waitForLoading3"/>
34+
</actionGroup>
3135

3236
<actionGroup name="LoggedInCheckoutFillNewBillingAddressActionGroup">
3337
<annotations>

app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<section name="CheckoutOrderSummarySection"/>
1515
<section name="CheckoutSuccessMainSection"/>
1616
<section name="CheckoutPaymentSection"/>
17+
<section name="SelectShippingBillingPopupSection"/>
1718
</page>
1819
</pages>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<element name="ProductOptionLinkActiveByProductItemName" type="text" selector="//div[@class='product-item-details']//strong[@class='product-item-name'][text()='{{var1}}']//ancestor::div[@class='product-item-details']//div[@class='product options active']//a[text() = '{{var2}}']" parameterized="true" />
4343
<element name="shipToInformation" type="text" selector="//div[@class='ship-to']//div[@class='shipping-information-content']" />
4444
<element name="shippingMethodInformation" type="text" selector="//div[@class='ship-via']//div[@class='shipping-information-content']" />
45+
<element name="shippingInformationSection" type="text" selector=".ship-to .shipping-information-content" />
4546
<element name="paymentMethodTitle" type="text" selector=".payment-method-title span" />
4647
<element name="productOptionsByProductItemPrice" type="text" selector="//div[@class='product-item-inner']//div[@class='subtotal']//span[@class='price'][contains(.,'{{price}}')]//ancestor::div[@class='product-item-details']//div[@class='product options']" parameterized="true"/>
4748
<element name="productOptionsActiveByProductItemPrice" type="text" selector="//div[@class='subtotal']//span[@class='price'][contains(.,'{{price}}')]//ancestor::div[@class='product-item-details']//div[@class='product options active']" parameterized="true"/>

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ define([
249249
if (this.validateShippingInformation()) {
250250
quote.billingAddress(null);
251251
checkoutDataResolver.resolveBillingAddress();
252+
registry.async('checkoutProvider')(function (checkoutProvider) {
253+
var shippingAddressData = checkoutData.getShippingAddressFromData();
254+
255+
if (shippingAddressData) {
256+
checkoutProvider.set(
257+
'shippingAddress',
258+
$.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData)
259+
);
260+
}
261+
});
252262
setShippingInformationAction().done(
253263
function () {
254264
stepNavigator.next();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Config\Model\Config\Backend\File;
8+
9+
/**
10+
* System config PDF field backend model.
11+
*/
12+
class Pdf extends \Magento\Config\Model\Config\Backend\File
13+
{
14+
/**
15+
* @inheritdoc
16+
*/
17+
protected function _getAllowedExtensions()
18+
{
19+
return ['pdf'];
20+
}
21+
}

app/code/Magento/Config/Model/Config/Backend/Image/Pdf.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* System config image field backend model for Zend PDF generator
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Config\Model\Config\Backend\Image;
138

149
/**
10+
* System config PDF field backend model.
11+
*
1512
* @api
1613
* @since 100.0.2
14+
* @see \Magento\Config\Model\Config\Backend\File\Pdf
1715
*/
1816
class Pdf extends \Magento\Config\Model\Config\Backend\Image
1917
{
2018
/**
19+
* Returns the list of allowed file extensions.
20+
*
2121
* @return string[]
2222
*/
2323
protected function _getAllowedExtensions()
2424
{
25-
return ['tif', 'tiff', 'png', 'jpg', 'jpe', 'jpeg'];
25+
return ['tif', 'tiff', 'png', 'jpg', 'jpe', 'jpeg', 'pdf'];
2626
}
2727
}

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@
5151
<data key="default_shipping">Yes</data>
5252
<requiredEntity type="region">RegionTX</requiredEntity>
5353
</entity>
54+
<entity name="US_Address_TX_Without_Default" type="address">
55+
<data key="firstname">John</data>
56+
<data key="lastname">Doe</data>
57+
<data key="company">Magento</data>
58+
<array key="street">
59+
<item>7700 West Parmer Lane</item>
60+
</array>
61+
<data key="city">Austin</data>
62+
<data key="state">Texas</data>
63+
<data key="country_id">US</data>
64+
<data key="country">United States</data>
65+
<data key="postcode">78729</data>
66+
<data key="telephone">512-345-6789</data>
67+
<requiredEntity type="region">RegionTX</requiredEntity>
68+
</entity>
5469
<entity name="US_Address_TX_Default_Billing" type="address">
5570
<data key="firstname">John</data>
5671
<data key="lastname">Doe</data>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@
4747
<data key="group">General</data>
4848
<requiredEntity type="address">US_Address_TX</requiredEntity>
4949
</entity>
50+
<entity name="Simple_US_Customer_Without_Default_Address" type="customer">
51+
<data key="group_id">1</data>
52+
<data key="default_billing">true</data>
53+
<data key="default_shipping">true</data>
54+
<data key="email" unique="prefix">[email protected]</data>
55+
<data key="firstname">John</data>
56+
<data key="lastname">Doe</data>
57+
<data key="fullname">John Doe</data>
58+
<data key="password">pwdTest123!</data>
59+
<data key="store_id">0</data>
60+
<data key="website_id">0</data>
61+
<data key="group">General</data>
62+
<requiredEntity type="address">US_Address_TX_Without_Default</requiredEntity>
63+
</entity>
5064
<entity name="SimpleUsCustomerWithNewCustomerGroup" type="customer">
5165
<data key="default_billing">true</data>
5266
<data key="default_shipping">true</data>

app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="downloadableLinkByTitle" type="input" selector="//*[@id='downloadable-links-list']/*[contains(.,'{{title}}')]//input" parameterized="true" timeout="30"/>
1515
<element name="downloadableLinkSampleByTitle" type="text" selector="//label[contains(., '{{title}}')]/a[contains(@class, 'sample link')]" parameterized="true"/>
1616
<element name="downloadableSampleLabel" type="text" selector="//a[contains(.,normalize-space('{{title}}'))]" parameterized="true" timeout="30"/>
17+
<element name="downloadableLinkSelectAllCheckbox" type="checkbox" selector="#links_all" />
1718
</section>
1819
</sections>

0 commit comments

Comments
 (0)