Skip to content

Commit

Permalink
merge magento/2.3-develop into magento-chaika/Chaika-PR-2019-09-26
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-cicd2 authored Sep 30, 2019
2 parents 0bca373 + f35c6eb commit e56bf94
Show file tree
Hide file tree
Showing 31 changed files with 791 additions and 81 deletions.
15 changes: 14 additions & 1 deletion app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Type;

/**
* Provides duplicating bundle options and selections
*/
class Bundle implements \Magento\Catalog\Model\Product\CopyConstructorInterface
{
/**
Expand All @@ -27,7 +30,17 @@ public function build(Product $product, Product $duplicate)
$bundleOptions = $product->getExtensionAttributes()->getBundleProductOptions() ?: [];
$duplicatedBundleOptions = [];
foreach ($bundleOptions as $key => $bundleOption) {
$duplicatedBundleOptions[$key] = clone $bundleOption;
$duplicatedBundleOption = clone $bundleOption;
/**
* Set option and selection ids to 'null' in order to create new option(selection) for duplicated product,
* but not modifying existing one, which led to lost of option(selection) in original product.
*/
$productLinks = $duplicatedBundleOption->getProductLinks() ?: [];
foreach ($productLinks as $productLink) {
$productLink->setSelectionId(null);
}
$duplicatedBundleOption->setOptionId(null);
$duplicatedBundleOptions[$key] = $duplicatedBundleOption;
}
$duplicate->getExtensionAttributes()->setBundleProductOptions($duplicatedBundleOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Bundle\Test\Unit\Model\Product\CopyConstructor;

use Magento\Bundle\Api\Data\BundleOptionInterface;
use Magento\Bundle\Model\Link;
use Magento\Bundle\Model\Product\CopyConstructor\Bundle;
use Magento\Catalog\Api\Data\ProductExtensionInterface;
use Magento\Catalog\Model\Product;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function testBuildNegative()
*/
public function testBuildPositive()
{
/** @var Product|\PHPUnit_Framework_MockObject_MockObject $product */
$product = $this->getMockBuilder(Product::class)
->disableOriginalConstructor()
->getMock();
Expand All @@ -60,18 +62,42 @@ public function testBuildPositive()
->method('getExtensionAttributes')
->willReturn($extensionAttributesProduct);

$productLink = $this->getMockBuilder(Link::class)
->setMethods(['setSelectionId'])
->disableOriginalConstructor()
->getMock();
$productLink->expects($this->exactly(2))
->method('setSelectionId')
->with($this->identicalTo(null));
$firstOption = $this->getMockBuilder(BundleOptionInterface::class)
->setMethods(['getProductLinks'])
->disableOriginalConstructor()
->getMockForAbstractClass();
$firstOption->expects($this->once())
->method('getProductLinks')
->willReturn([$productLink]);
$firstOption->expects($this->once())
->method('setOptionId')
->with($this->identicalTo(null));
$secondOption = $this->getMockBuilder(BundleOptionInterface::class)
->setMethods(['getProductLinks'])
->disableOriginalConstructor()
->getMockForAbstractClass();
$secondOption->expects($this->once())
->method('getProductLinks')
->willReturn([$productLink]);
$secondOption->expects($this->once())
->method('setOptionId')
->with($this->identicalTo(null));
$bundleOptions = [
$this->getMockBuilder(BundleOptionInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass(),
$this->getMockBuilder(BundleOptionInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass()
$firstOption,
$secondOption
];
$extensionAttributesProduct->expects($this->once())
->method('getBundleProductOptions')
->willReturn($bundleOptions);

/** @var Product|\PHPUnit_Framework_MockObject_MockObject $duplicate */
$duplicate = $this->getMockBuilder(Product::class)
->disableOriginalConstructor()
->getMock();
Expand Down
48 changes: 33 additions & 15 deletions app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,63 @@
*/
namespace Magento\Catalog\Controller\Adminhtml\Product\Set;

use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
use Magento\Framework\Registry;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\ObjectManager;
use Magento\Backend\Model\View\Result\Page;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Controller\ResultInterface;
use Magento\Eav\Api\AttributeSetRepositoryInterface;
use Magento\Catalog\Controller\Adminhtml\Product\Set;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\App\Action\HttpGetActionInterface;

class Edit extends \Magento\Catalog\Controller\Adminhtml\Product\Set implements HttpGetActionInterface
/**
* Edit attribute set controller.
*/
class Edit extends Set implements HttpGetActionInterface
{
/**
* @var \Magento\Framework\View\Result\PageFactory
* @var PageFactory
*/
protected $resultPageFactory;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @var AttributeSetRepositoryInterface
*/
private $attributeSetRepository;

/**
* @param Context $context
* @param Registry $coreRegistry
* @param PageFactory $resultPageFactory
* @param AttributeSetRepositoryInterface $attributeSetRepository
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
Context $context,
Registry $coreRegistry,
PageFactory $resultPageFactory,
AttributeSetRepositoryInterface $attributeSetRepository = null
) {
parent::__construct($context, $coreRegistry);
$this->resultPageFactory = $resultPageFactory;
$this->attributeSetRepository = $attributeSetRepository ?:
ObjectManager::getInstance()->get(AttributeSetRepositoryInterface::class);
}

/**
* @return \Magento\Backend\Model\View\Result\Page
* @inheritdoc
*/
public function execute()
{
$this->_setTypeId();
$attributeSet = $this->_objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class)
->load($this->getRequest()->getParam('id'));

$attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id'));
if (!$attributeSet->getId()) {
return $this->resultRedirectFactory->create()->setPath('catalog/*/index');
}

$this->_coreRegistry->register('current_attribute_set', $attributeSet);

/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
/** @var Page $resultPage */
$resultPage = $this->resultPageFactory->create();
$resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets');
$resultPage->getConfig()->getTitle()->prepend(__('Attribute Sets'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
</strong>
<?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
<?= /* @noEscape */ $block->getProductPrice($_product) ?>
<?= $block->getProductDetailsHtml($_product) ?>
<?php if ($_product->isAvailable()) :?>
<?= $block->getProductDetailsHtml($_product) ?>
<?php endif; ?>

<div class="product-item-inner">
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public function __construct(
}

/**
* Get breadcrumbs data
*
* @param string $categoryPath
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getData(string $categoryPath): array
{
Expand All @@ -41,7 +44,7 @@ public function getData(string $categoryPath): array

if (count($parentCategoryIds)) {
$collection = $this->collectionFactory->create();
$collection->addAttributeToSelect(['name', 'url_key']);
$collection->addAttributeToSelect(['name', 'url_key', 'url_path']);
$collection->addAttributeToFilter('entity_id', $parentCategoryIds);

foreach ($collection as $category) {
Expand All @@ -50,6 +53,7 @@ public function getData(string $categoryPath): array
'category_name' => $category->getName(),
'category_level' => $category->getLevel(),
'category_url_key' => $category->getUrlKey(),
'category_url_path' => $category->getUrlPath(),
];
}
}
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ type Breadcrumb @doc(description: "Breadcrumb item."){
category_name: String @doc(description: "Category name.")
category_level: Int @doc(description: "Category level.")
category_url_key: String @doc(description: "Category URL key.")
category_url_path: String @doc(description: "Category URL path.")
}

type CustomizableRadioOption implements CustomizableOptionInterface @doc(description: "CustomizableRadioOption contains information about a set of radio buttons that are defined as part of a customizable option.") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
<scrollToTopOfPage stepKey="scrollToTop"/>
<waitForPageLoad stepKey="waitForApplied"/>
</actionGroup>

<actionGroup name="AdminCreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule">
<remove keyForRemoval="selectSite"/>
<selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/>
</actionGroup>
<actionGroup name="CreateCatalogPriceRuleViaTheUi">
<arguments>
<argument name="catalogRule" defaultValue="_defaultCatalogRule"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<fillField selector="{{CheckoutPaymentSection.guestPostcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
<fillField selector="{{CheckoutPaymentSection.guestTelephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
</actionGroup>
<actionGroup name="StorefrontCheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup">
<remove keyForRemoval="enterEmail"/>
<remove keyForRemoval="waitForLoading3"/>
</actionGroup>

<actionGroup name="LoggedInCheckoutFillNewBillingAddressActionGroup">
<annotations>
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
<section name="CheckoutOrderSummarySection"/>
<section name="CheckoutSuccessMainSection"/>
<section name="CheckoutPaymentSection"/>
<section name="SelectShippingBillingPopupSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<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" />
<element name="shipToInformation" type="text" selector="//div[@class='ship-to']//div[@class='shipping-information-content']" />
<element name="shippingMethodInformation" type="text" selector="//div[@class='ship-via']//div[@class='shipping-information-content']" />
<element name="shippingInformationSection" type="text" selector=".ship-to .shipping-information-content" />
<element name="paymentMethodTitle" type="text" selector=".payment-method-title span" />
<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"/>
<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"/>
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ define([
if (this.validateShippingInformation()) {
quote.billingAddress(null);
checkoutDataResolver.resolveBillingAddress();
registry.async('checkoutProvider')(function (checkoutProvider) {
var shippingAddressData = checkoutData.getShippingAddressFromData();

if (shippingAddressData) {
checkoutProvider.set(
'shippingAddress',
$.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData)
);
}
});
setShippingInformationAction().done(
function () {
stepNavigator.next();
Expand Down
15 changes: 15 additions & 0 deletions app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@
<data key="default_shipping">Yes</data>
<requiredEntity type="region">RegionTX</requiredEntity>
</entity>
<entity name="US_Address_TX_Without_Default" type="address">
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="company">Magento</data>
<array key="street">
<item>7700 West Parmer Lane</item>
</array>
<data key="city">Austin</data>
<data key="state">Texas</data>
<data key="country_id">US</data>
<data key="country">United States</data>
<data key="postcode">78729</data>
<data key="telephone">512-345-6789</data>
<requiredEntity type="region">RegionTX</requiredEntity>
</entity>
<entity name="US_Address_TX_Default_Billing" type="address">
<data key="firstname">John</data>
<data key="lastname">Doe</data>
Expand Down
14 changes: 14 additions & 0 deletions app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@
<data key="group">General</data>
<requiredEntity type="address">US_Address_TX</requiredEntity>
</entity>
<entity name="Simple_US_Customer_Without_Default_Address" type="customer">
<data key="group_id">1</data>
<data key="default_billing">true</data>
<data key="default_shipping">true</data>
<data key="email" unique="prefix">John.Doe@example.com</data>
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="fullname">John Doe</data>
<data key="password">pwdTest123!</data>
<data key="store_id">0</data>
<data key="website_id">0</data>
<data key="group">General</data>
<requiredEntity type="address">US_Address_TX_Without_Default</requiredEntity>
</entity>
<entity name="SimpleUsCustomerWithNewCustomerGroup" type="customer">
<data key="default_billing">true</data>
<data key="default_shipping">true</data>
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Paypal/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
<title>Credit Card (Payflow Advanced)</title>
<partner>PayPal</partner>
<vendor>PayPal</vendor>
<user>PayPal</user>
<csc_required>1</csc_required>
<csc_editable>1</csc_editable>
<url_method>GET</url_method>
Expand Down
Loading

0 comments on commit e56bf94

Please sign in to comment.