Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit dd965b9

Browse files
authored
Merge pull request #3 from magento/2.3-develop
merge latest changes
2 parents 3ba9281 + 877bffd commit dd965b9

File tree

22 files changed

+297
-113
lines changed

22 files changed

+297
-113
lines changed

app/code/Magento/Backup/Controller/Adminhtml/Index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@
55
*/
66
namespace Magento\Backup\Controller\Adminhtml;
77

8+
use Magento\Backend\App\Action;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
811
/**
912
* Backup admin controller
1013
*
1114
* @author Magento Core Team <[email protected]>
1215
* @api
1316
* @since 100.0.2
1417
*/
15-
abstract class Index extends \Magento\Backend\App\Action
18+
abstract class Index extends Action implements HttpGetActionInterface
1619
{
1720
/**
1821
* Authorization level of a basic admin session
1922
*
2023
* @see _isAllowed()
2124
*/
22-
const ADMIN_RESOURCE = 'Magento_Backend::backup';
25+
const ADMIN_RESOURCE = 'Magento_Backup::backup';
2326

2427
/**
2528
* Core registry

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductHtmlAttribute.php renamed to app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductComplexTextAttribute.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
99

10-
use Magento\Catalog\Model\Product;
1110
use Magento\Framework\GraphQl\Config\Element\Field;
12-
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1311
use Magento\Framework\GraphQl\Query\ResolverInterface;
1412
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
13+
use Magento\Catalog\Model\Product;
14+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1515
use Magento\Catalog\Helper\Output as OutputHelper;
1616

1717
/**
1818
* Resolve rendered content for attributes where HTML content is allowed
1919
*/
20-
class ProductHtmlAttribute implements ResolverInterface
20+
class ProductComplexTextAttribute implements ResolverInterface
2121
{
2222
/**
2323
* @var OutputHelper
@@ -42,7 +42,7 @@ public function resolve(
4242
ResolveInfo $info,
4343
array $value = null,
4444
array $args = null
45-
) {
45+
): array {
4646
if (!isset($value['model'])) {
4747
throw new GraphQlInputException(__('"model" value should be specified'));
4848
}
@@ -51,6 +51,7 @@ public function resolve(
5151
$product = $value['model'];
5252
$fieldName = $field->getName();
5353
$renderedValue = $this->outputHelper->productAttribute($product, $product->getData($fieldName), $fieldName);
54-
return $renderedValue;
54+
55+
return ['html' => $renderedValue ?? ''];
5556
}
5657
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
248248
id: Int @doc(description: "The ID number assigned to the product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\EntityIdToId")
249249
name: String @doc(description: "The product name. Customers use this name to identify the product.")
250250
sku: String @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer")
251-
description: String @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
252-
short_description: String @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
251+
description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
252+
short_description: ComplexTextValue @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
253253
special_price: Float @doc(description: "The discounted price of the product")
254254
special_from_date: String @doc(description: "The beginning date that a product has a special price")
255255
special_to_date: String @doc(description: "The end date that a product has a special price")

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ enum SortEnum @doc(description: "This enumeration indicates whether to return re
3636
ASC
3737
DESC
3838
}
39+
40+
type ComplexTextValue {
41+
html: String! @doc(description: "HTML format")
42+
}

app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function getAssociatedProducts($product)
236236
*/
237237
public function flushAssociatedProductsCache($product)
238238
{
239-
return $product->unsData($this->_keyAssociatedProducts);
239+
return $product->unsetData($this->_keyAssociatedProducts);
240240
}
241241

242242
/**

app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,9 @@ public function testPrepareForCartAdvancedZeroQty()
611611

612612
public function testFlushAssociatedProductsCache()
613613
{
614-
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsData']);
614+
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsetData']);
615615
$productMock->expects($this->once())
616-
->method('unsData')
616+
->method('unsetData')
617617
->with('_cache_instance_associated_products')
618618
->willReturnSelf();
619619
$this->assertEquals($productMock, $this->_model->flushAssociatedProductsCache($productMock));

app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/>
2828
<waitForPageLoad stepKey="waitForDisable"/>
2929
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
30+
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
3031
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
3132
</actionGroup>
3233
</actionGroups>

app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function beforeSave()
113113
/**
114114
* Retrieve visitor id
115115
*
116-
* if don't exists return current visitor id
116+
* If don't exists return current visitor id
117117
*
118118
* @return int
119119
*/
@@ -128,7 +128,7 @@ public function getVisitorId()
128128
/**
129129
* Retrieve customer id
130130
*
131-
* if customer don't logged in return null
131+
* If customer don't logged in return null
132132
*
133133
* @return int
134134
*/
@@ -143,7 +143,7 @@ public function getCustomerId()
143143
/**
144144
* Retrieve store id
145145
*
146-
* default return current store id
146+
* Default return current store id
147147
*
148148
* @return int
149149
*/
@@ -246,13 +246,14 @@ public function clean()
246246

247247
/**
248248
* Add product ids to current visitor/customer log
249+
*
249250
* @param string[] $productIds
250251
* @return $this
251252
*/
252253
public function registerIds($productIds)
253254
{
254255
$this->_getResource()->registerIds($this, $productIds);
255-
$this->_getSession()->unsData($this->_countCacheKey);
256+
$this->_getSession()->unsetData($this->_countCacheKey);
256257
return $this;
257258
}
258259
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Store\ViewModel;
10+
11+
use Magento\Framework\App\ActionInterface;
12+
use Magento\Framework\Url\EncoderInterface;
13+
use Magento\Framework\UrlInterface;
14+
use Magento\Store\Model\Store;
15+
use Magento\Store\Model\StoreManagerInterface;
16+
17+
/**
18+
* Provides target store redirect url.
19+
*/
20+
class SwitcherUrlProvider implements \Magento\Framework\View\Element\Block\ArgumentInterface
21+
{
22+
/**
23+
* @var EncoderInterface
24+
*/
25+
private $encoder;
26+
27+
/**
28+
* @var StoreManagerInterface
29+
*/
30+
private $storeManager;
31+
32+
/**
33+
* @var UrlInterface
34+
*/
35+
private $urlBuilder;
36+
37+
/**
38+
* @param EncoderInterface $encoder
39+
* @param StoreManagerInterface $storeManager
40+
* @param UrlInterface $urlBuilder
41+
*/
42+
public function __construct(
43+
EncoderInterface $encoder,
44+
StoreManagerInterface $storeManager,
45+
UrlInterface $urlBuilder
46+
) {
47+
$this->encoder = $encoder;
48+
$this->storeManager = $storeManager;
49+
$this->urlBuilder = $urlBuilder;
50+
}
51+
52+
/**
53+
* Returns target store redirect url.
54+
*
55+
* @param Store $store
56+
* @return string
57+
* @throws \Magento\Framework\Exception\NoSuchEntityException
58+
*/
59+
public function getTargetStoreRedirectUrl(Store $store): string
60+
{
61+
return $this->urlBuilder->getUrl(
62+
'stores/store/redirect',
63+
[
64+
'___store' => $store->getCode(),
65+
'___from_store' => $this->storeManager->getStore()->getCode(),
66+
ActionInterface::PARAM_NAME_URL_ENCODED => $this->encoder->encode(
67+
$store->getCurrentUrl(false)
68+
),
69+
]
70+
);
71+
}
72+
}

app/code/Magento/Store/view/frontend/templates/switch/languages.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<?php foreach ($block->getStores() as $_lang): ?>
2828
<?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
2929
<li class="view-<?= $block->escapeHtml($_lang->getCode()) ?> switcher-option">
30-
<a href="#" data-post='<?= /* @noEscape */ $block->getTargetStorePostData($_lang) ?>'>
30+
<a href="<?= $block->escapeUrl($block->getViewModel()->getTargetStoreRedirectUrl($_lang)) ?>">
3131
<?= $block->escapeHtml($_lang->getName()) ?>
3232
</a>
3333
</li>

app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@
251251
<severity value="CRITICAL"/>
252252
<testCaseId value="MC-297"/>
253253
<group value="Tax"/>
254+
<skip>
255+
<issueId value="MAGETWO-96266"/>
256+
</skip>
254257
</annotations>
255258
<before>
256259
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>

app/code/Magento/Theme/view/frontend/layout/default.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
<argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
4040
</arguments>
4141
</block>
42-
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>
42+
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml">
43+
<arguments>
44+
<argument name="view_model" xsi:type="object">Magento\Store\ViewModel\SwitcherUrlProvider</argument>
45+
</arguments>
46+
</block>
4347
<block class="Magento\Customer\Block\Account\Navigation" name="top.links">
4448
<arguments>
4549
<argument name="css_class" xsi:type="string">header links</argument>
@@ -82,6 +86,7 @@
8286
<block class="Magento\Store\Block\Switcher" name="store.settings.language" template="Magento_Store::switch/languages.phtml">
8387
<arguments>
8488
<argument name="id_modifier" xsi:type="string">nav</argument>
89+
<argument name="view_model" xsi:type="object">Magento\Store\ViewModel\SwitcherUrlProvider</argument>
8590
</arguments>
8691
</block>
8792
<block class="Magento\Directory\Block\Currency" name="store.settings.currency" template="Magento_Directory::currency.phtml">

app/code/Magento/Weee/Model/Sales/Pdf/Weee.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ public function __construct(
3636
/**
3737
* Check if weee total amount should be included
3838
*
39+
* Example:
3940
* array(
4041
* $index => array(
4142
* 'amount' => $amount,
4243
* 'label' => $label,
4344
* 'font_size'=> $font_size
4445
* )
4546
* )
47+
*
4648
* @return array
4749
*/
4850
public function getTotalsForDisplay()
@@ -70,4 +72,17 @@ public function getTotalsForDisplay()
7072

7173
return $totals;
7274
}
75+
76+
/**
77+
* Check if we can display Weee total information in PDF
78+
*
79+
* @return bool
80+
*/
81+
public function canDisplay()
82+
{
83+
$items = $this->getSource()->getAllItems();
84+
$store = $this->getSource()->getStore();
85+
$amount = $this->_weeeData->getTotalAmounts($items, $store);
86+
return $this->getDisplayZero() === 'true' || $amount != 0;
87+
}
7388
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"require-dev": {
8585
"friendsofphp/php-cs-fixer": "~2.13.0",
8686
"lusitanian/oauth": "~0.8.10",
87-
"magento/magento2-functional-testing-framework": "2.3.9",
87+
"magento/magento2-functional-testing-framework": "2.3.11",
8888
"pdepend/pdepend": "2.5.2",
8989
"phpmd/phpmd": "@stable",
9090
"phpunit/phpunit": "~6.5.0",

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ public function testCategoryProducts()
132132
attribute_set_id
133133
country_of_manufacture
134134
created_at
135-
description
135+
description {
136+
html
137+
}
136138
gift_message_available
137139
id
138140
categories {
@@ -222,7 +224,9 @@ public function testCategoryProducts()
222224
position
223225
sku
224226
}
225-
short_description
227+
short_description {
228+
html
229+
}
226230
sku
227231
small_image { url, label }
228232
thumbnail { url, label }

0 commit comments

Comments
 (0)