Skip to content

Commit 0adff35

Browse files
[Magento Community Engineering] Community Contributions - 2.3-develop
- merged latest code from mainline branch
2 parents 7b6ec93 + 8441cf4 commit 0adff35

File tree

13 files changed

+187
-3
lines changed

13 files changed

+187
-3
lines changed

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();

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/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,18 @@
105105
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/>
106106
<checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/>
107107
</actionGroup>
108-
108+
<actionGroup name="AdminCreateMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup">
109+
<annotations>
110+
<description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'clickSaveButton' for the next data changing. Assign cart price rule to 2 websites instead of 1.</description>
111+
</annotations>
112+
<arguments>
113+
<argument name="ruleName"/>
114+
</arguments>
115+
<remove keyForRemoval="clickSaveButton"/>
116+
<remove keyForRemoval="seeSuccessMessage"/>
117+
<remove keyForRemoval="selectWebsites"/>
118+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsites" after="fillRuleName"/>
119+
</actionGroup>
109120
<actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup">
110121
<annotations>
111122
<description>Goes to the Admin Cart Price Rule grid page. Clicks on Add New Rule. Fills the provided Rule (Name). Selects 'Second Website' from the 'Websites' menu.</description>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<element name="description" type="textarea" selector="//div[@class='admin__field-control']/textarea[@name='description']"/>
2020
<element name="active" type="checkbox" selector="//div[@class='admin__actions-switch']/input[@name='is_active']/../label"/>
2121
<element name="websites" type="multiselect" selector="select[name='website_ids']"/>
22+
<element name="websitesOptions" type="select" selector="[name='website_ids'] option"/>
2223
<element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/>
2324
<element name="customerGroupsOptions" type="multiselect" selector="select[name='customer_group_ids'] option"/>
2425
<element name="coupon" type="select" selector="select[name='coupon_type']"/>

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,57 @@ public function testAnchorCategory()
502502
$this->assertEquals($expectedResponse, $response);
503503
}
504504

505+
/**
506+
* @magentoApiDataFixture Magento/Catalog/_files/categories.php
507+
*/
508+
public function testBreadCrumbs()
509+
{
510+
/** @var CategoryCollection $categoryCollection */
511+
$categoryCollection = $this->objectManager->create(CategoryCollection::class);
512+
$categoryCollection->addFieldToFilter('name', 'Category 1.1.1');
513+
/** @var CategoryInterface $category */
514+
$category = $categoryCollection->getFirstItem();
515+
$categoryId = $category->getId();
516+
$this->assertNotEmpty($categoryId, "Preconditions failed: category is not available.");
517+
$query = <<<QUERY
518+
{
519+
category(id: {$categoryId}) {
520+
name
521+
breadcrumbs {
522+
category_id
523+
category_name
524+
category_level
525+
category_url_key
526+
category_url_path
527+
}
528+
}
529+
}
530+
QUERY;
531+
$response = $this->graphQlQuery($query);
532+
$expectedResponse = [
533+
'category' => [
534+
'name' => 'Category 1.1.1',
535+
'breadcrumbs' => [
536+
[
537+
'category_id' => 3,
538+
'category_name' => "Category 1",
539+
'category_level' => 2,
540+
'category_url_key' => "category-1",
541+
'category_url_path' => "category-1"
542+
],
543+
[
544+
'category_id' => 4,
545+
'category_name' => "Category 1.1",
546+
'category_level' => 3,
547+
'category_url_key' => "category-1-1",
548+
'category_url_path' => "category-1/category-1-1"
549+
],
550+
]
551+
]
552+
];
553+
$this->assertEquals($expectedResponse, $response);
554+
}
555+
505556
/**
506557
* @param ProductInterface $product
507558
* @param array $actualResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\ConfigurableProduct\Block\Cart\Item\Renderer;
7+
8+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable as ConfigurableRenderer;
10+
use Magento\Framework\ObjectManagerInterface;
11+
use Magento\Framework\View\LayoutInterface;
12+
13+
/**
14+
* Test \Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable block
15+
*
16+
* @magentoAppArea frontend
17+
*/
18+
class ConfigurableTest extends \PHPUnit\Framework\TestCase
19+
{
20+
/**
21+
* @var ConfigurableRenderer
22+
*/
23+
private $block;
24+
25+
/**
26+
* @var ObjectManagerInterface
27+
*/
28+
private $objectManager;
29+
30+
/**
31+
* @inheritdoc
32+
*/
33+
protected function setUp()
34+
{
35+
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
36+
$this->block = $this->objectManager->get(LayoutInterface::class)
37+
->createBlock(ConfigurableRenderer::class);
38+
}
39+
40+
/**
41+
* @magentoDbIsolation enabled
42+
* @magentoAppIsolation enabled
43+
* @magentoDataFixture Magento/ConfigurableProduct/_files/quote_with_configurable_product.php
44+
*/
45+
public function testGetProductPriceHtml()
46+
{
47+
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
48+
$configurableProduct = $productRepository->getById(1);
49+
50+
$layout = $this->objectManager->get(LayoutInterface::class);
51+
$layout->createBlock(
52+
\Magento\Framework\Pricing\Render::class,
53+
'product.price.render.default',
54+
[
55+
'data' => [
56+
'price_render_handle' => 'catalog_product_prices',
57+
'use_link_for_as_low_as' => true
58+
]
59+
]
60+
);
61+
62+
$this->block->setItem(
63+
$this->block->getCheckoutSession()->getQuote()->getAllVisibleItems()[0]
64+
);
65+
$html = $this->block->getProductPriceHtml($configurableProduct);
66+
$this->assertContains('<span class="price">$10.00</span>', $html);
67+
}
68+
}

0 commit comments

Comments
 (0)