Skip to content

Commit a435536

Browse files
committed
Merge branch 'team3-delivery' of github.com:magento-trigger/magento2ce into team3-delivery
1 parent 8a3eb4b commit a435536

File tree

16 files changed

+201
-25
lines changed

16 files changed

+201
-25
lines changed

app/code/Magento/Braintree/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
<!-- PayPal value handlers infrastructure -->
448448
<type name="Magento\Braintree\Gateway\Response\PayPal\VaultDetailsHandler">
449449
<arguments>
450-
<argument name="paymentTokenFactory" xsi:type="object">Magento\Vault\Model\AccountPaymentTokenFactory</argument>
450+
<argument name="paymentTokenFactory" xsi:type="object">Magento\Vault\Api\Data\PaymentTokenFactoryInterface</argument>
451451
</arguments>
452452
</type>
453453
<virtualType name="BraintreePayPalValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ public function execute()
139139
->setName($name)
140140
->getAttributeSet();
141141
} catch (AlreadyExistsException $alreadyExists) {
142-
$this->messageManager->addErrorMessage(
143-
__('A "%1" attribute set name already exists. Create a new name and try again.', $name)
144-
);
142+
$this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name));
145143
$this->_session->setAttributeData($data);
146144
return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]);
147145
} catch (LocalizedException $e) {
@@ -202,6 +200,8 @@ public function execute()
202200
}
203201
}
204202

203+
$data = $this->presentation->convertPresentationDataToInputType($data);
204+
205205
if ($attributeId) {
206206
if (!$model->getId()) {
207207
$this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
@@ -216,7 +216,6 @@ public function execute()
216216

217217
$data['attribute_code'] = $model->getAttributeCode();
218218
$data['is_user_defined'] = $model->getIsUserDefined();
219-
$data['frontend_input'] = $model->getFrontendInput();
220219
} else {
221220
/**
222221
* @todo add to helper and specify all relations for properties
@@ -229,8 +228,6 @@ public function execute()
229228
);
230229
}
231230

232-
$data = $this->presentation->convertPresentationDataToInputType($data);
233-
234231
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];
235232

236233
if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {

app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Inputtype/Presentation.php

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

7+
declare(strict_types=1);
8+
79
namespace Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype;
810

911
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
@@ -19,9 +21,9 @@ class Presentation
1921
* Get input type for presentation layer from stored input type.
2022
*
2123
* @param Attribute $attribute
22-
* @return string
24+
* @return string|null
2325
*/
24-
public function getPresentationInputType(Attribute $attribute)
26+
public function getPresentationInputType(Attribute $attribute) :?string
2527
{
2628
$inputType = $attribute->getFrontendInput();
2729
if ($inputType == 'textarea' && $attribute->getIsWysiwygEnabled()) {
@@ -37,12 +39,12 @@ public function getPresentationInputType(Attribute $attribute)
3739
*
3840
* @return array
3941
*/
40-
public function convertPresentationDataToInputType(array $data)
42+
public function convertPresentationDataToInputType(array $data) : array
4143
{
42-
if ($data['frontend_input'] === 'texteditor') {
44+
if (isset($data['frontend_input']) && $data['frontend_input'] === 'texteditor') {
4345
$data['is_wysiwyg_enabled'] = 1;
4446
$data['frontend_input'] = 'textarea';
45-
} elseif ($data['frontend_input'] === 'textarea') {
47+
} elseif (isset($data['frontend_input']) && $data['frontend_input'] === 'textarea') {
4648
$data['is_wysiwyg_enabled'] = 0;
4749
}
4850
return $data;
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Test\Unit\Model\Product\Attribute\Frontend\InputType;
9+
10+
class PresentationTest extends \PHPUnit\Framework\TestCase
11+
{
12+
/**
13+
* @var \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation
14+
*/
15+
private $presentation;
16+
17+
/**
18+
* @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute| \PHPUnit_Framework_MockObject_MockObject
19+
*/
20+
private $attributeMock;
21+
22+
protected function setUp()
23+
{
24+
$this->presentation = new \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation();
25+
$this->attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
26+
->disableOriginalConstructor()
27+
->getMock();
28+
}
29+
30+
/**
31+
* @param string $inputType
32+
* @param boolean $isWysiwygEnabled
33+
* @param string $expectedResult
34+
* @dataProvider getPresentationInputTypeDataProvider
35+
*/
36+
public function testGetPresentationInputType(string $inputType, bool $isWysiwygEnabled, string $expectedResult)
37+
{
38+
$this->attributeMock->expects($this->once())->method('getFrontendInput')->willReturn($inputType);
39+
$this->attributeMock->expects($this->any())->method('getIsWysiwygEnabled')->willReturn($isWysiwygEnabled);
40+
$this->assertEquals($expectedResult, $this->presentation->getPresentationInputType($this->attributeMock));
41+
}
42+
43+
public function getPresentationInputTypeDataProvider()
44+
{
45+
return [
46+
'attribute_is_textarea_and_wysiwyg_enabled' => ['textarea', true, 'texteditor'],
47+
'attribute_is_input_and_wysiwyg_enabled' => ['input', true, 'input'],
48+
'attribute_is_textarea_and_wysiwyg_disabled' => ['textarea', false, 'textarea'],
49+
];
50+
}
51+
52+
/**
53+
* @param array $data
54+
* @param array $expectedResult
55+
* @dataProvider convertPresentationDataToInputTypeDataProvider
56+
*/
57+
public function testConvertPresentationDataToInputType(array $data, array $expectedResult)
58+
{
59+
$this->assertEquals($expectedResult, $this->presentation->convertPresentationDataToInputType($data));
60+
}
61+
62+
public function convertPresentationDataToInputTypeDataProvider()
63+
{
64+
return [
65+
[['key' => 'value'], ['key' => 'value']],
66+
[
67+
['frontend_input' => 'texteditor'],
68+
['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 1]
69+
],
70+
[
71+
['frontend_input' => 'textarea'],
72+
['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 0]
73+
],
74+
[
75+
['frontend_input' => 'input'],
76+
['frontend_input' => 'input']
77+
]
78+
];
79+
}
80+
}

app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
$.widget('mage.shoppingCart', {
1313
/** @inheritdoc */
1414
_create: function () {
15-
var items, i;
15+
var items, i, reload;
1616

1717
$(this.options.emptyCartButton).on('click', $.proxy(function () {
1818
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
@@ -36,6 +36,27 @@ define([
3636
$(this.options.continueShoppingButton).on('click', $.proxy(function () {
3737
location.href = this.options.continueShoppingUrl;
3838
}, this));
39+
40+
$(document).on('ajax:removeFromCart', $.proxy(function () {
41+
reload = true;
42+
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
43+
if (reload === true) {
44+
location.reload();
45+
reload = false;
46+
}
47+
$('div.block.block-minicart').off('dropdowndialogclose');
48+
}));
49+
}, this));
50+
$(document).on('ajax:updateItemQty', $.proxy(function () {
51+
reload = true;
52+
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
53+
if (reload === true) {
54+
location.reload();
55+
reload = false;
56+
}
57+
$('div.block.block-minicart').off('dropdowndialogclose');
58+
}));
59+
}, this));
3960
}
4061
});
4162

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ define([
220220
*/
221221
_updateItemQtyAfter: function (elem) {
222222
this._hideItemButton(elem);
223+
$(document).trigger('ajax:updateItemQty');
223224
},
224225

225226
/**

app/code/Magento/Ui/Block/Wysiwyg/ActiveEditor.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
class ActiveEditor extends \Magento\Framework\View\Element\Template
1818
{
1919
const DEFAULT_EDITOR_PATH = 'mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter';
20+
2021
/**
2122
* @var ScopeConfigInterface
2223
*/
@@ -27,11 +28,6 @@ class ActiveEditor extends \Magento\Framework\View\Element\Template
2728
*/
2829
private $availableAdapterPaths;
2930

30-
/**
31-
* @param Context $context
32-
* @param ScopeConfigInterface $scopeConfig
33-
* @param array $data
34-
*/
3531
/**
3632
* ActiveEditor constructor.
3733
* @param Context $context

app/code/Magento/Vault/Model/PaymentTokenFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class PaymentTokenFactory implements PaymentTokenFactoryInterface
2222
*/
2323
private $tokenTypes = [];
2424

25+
/**
26+
* @var ObjectManagerInterface
27+
*/
28+
private $objectManager;
29+
2530
/**
2631
* PaymentTokenFactory constructor.
2732
* @param ObjectManagerInterface $objectManager

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
<description value="Admin should be able to switch between 2 version of Tinymce in the admin back-end."/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-85745"/>
19-
<!-- Skipped, see https://jira.corp.magento.com/browse/MQE-890 -->
20-
<group value="skip"/>
2119
</annotations>
2220
<before>
2321
<actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartProductSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@
2424
<element name="ProductOptionByNameAndAttribute" type="input"
2525
selector="//main//table[@id='shopping-cart-table']//tbody//tr[.//strong[contains(@class, 'product-item-name')]//a[contains(text(), '{{var1}}')]]//dl[@class='item-options']//dt[.='{{var2}}']/following-sibling::dd[1]"
2626
parameterized="true"/>
27+
<element name="RemoveItem" type="button"
28+
selector="//table[@id='shopping-cart-table']//tbody//tr[contains(@class,'item-actions')]//a[contains(@class,'action-delete')]"/>
2729
</section>
2830
</sections>

0 commit comments

Comments
 (0)