Skip to content

Commit 1b694b6

Browse files
committed
Merge branch '2.3-develop' of github.com:magento-engcom/magento2ce into coding-standard-update
# Conflicts: # composer.lock
2 parents 91a5972 + 67fe58f commit 1b694b6

File tree

283 files changed

+8666
-1060
lines changed

Some content is hidden

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

283 files changed

+8666
-1060
lines changed

app/code/Magento/Analytics/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<label>Advanced Reporting</label>
1616
<comment><![CDATA[This service provides a dynamic suite of reports with rich insights about your business.
1717
Your reports can be accessed securely on a personalized dashboard outside of the admin panel by clicking on the
18-
"Go to Advanced Reporting" link. </br> For more information, see our <a href="https://magento.com/legal/terms/cloud-terms">
18+
"Go to Advanced Reporting" link. </br> For more information, see our <a target="_blank" href="https://magento.com/legal/terms/cloud-terms">
1919
terms and conditions</a>.]]></comment>
2020
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
2121
<label>Advanced Reporting Service</label>

app/code/Magento/AsynchronousOperations/Model/BulkStatus.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,6 @@ public function getFailedOperationsByBulkId($bulkUuid, $failureType = null)
8787
*/
8888
public function getOperationsCountByBulkIdAndStatus($bulkUuid, $status)
8989
{
90-
if ($status === OperationInterface::STATUS_TYPE_OPEN) {
91-
/**
92-
* Total number of operations that has been scheduled within the given bulk
93-
*/
94-
$allOperationsQty = $this->getOperationCount($bulkUuid);
95-
96-
/**
97-
* Number of operations that has been processed (i.e. operations with any status but 'open')
98-
*/
99-
$allProcessedOperationsQty = (int)$this->operationCollectionFactory->create()
100-
->addFieldToFilter('bulk_uuid', $bulkUuid)
101-
->getSize();
102-
103-
return $allOperationsQty - $allProcessedOperationsQty;
104-
}
105-
10690
/** @var \Magento\AsynchronousOperations\Model\ResourceModel\Operation\Collection $collection */
10791
$collection = $this->operationCollectionFactory->create();
10892
return $collection->addFieldToFilter('bulk_uuid', $bulkUuid)

app/code/Magento/Backend/Model/Menu/Item/Validator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
namespace Magento\Backend\Model\Menu\Item;
77

88
/**
9+
* Class Validator
10+
*
11+
* @package Magento\Backend\Model\Menu\Item
912
* @api
1013
* @since 100.0.2
1114
*/
@@ -49,7 +52,7 @@ public function __construct()
4952

5053
$attributeValidator = new \Zend_Validate();
5154
$attributeValidator->addValidator(new \Zend_Validate_StringLength(['min' => 3]));
52-
$attributeValidator->addValidator(new \Zend_Validate_Regex('/^[A-Za-z0-9\/_]+$/'));
55+
$attributeValidator->addValidator(new \Zend_Validate_Regex('/^[A-Za-z0-9\/_\-]+$/'));
5356

5457
$textValidator = new \Zend_Validate_StringLength(['min' => 3, 'max' => 50]);
5558

@@ -101,6 +104,7 @@ private function checkMenuItemIsRemoved($data)
101104

102105
/**
103106
* Check that menu item contains all required data
107+
*
104108
* @param array $data
105109
*
106110
* @throws \BadMethodCallException

app/code/Magento/Backend/Test/Unit/Model/Menu/Config/_files/invalidMenuXmlArray.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
' resource="Test_Value::value"/></menu></config>',
1111
[
1212
"Element 'add', attribute 'action': [facet 'pattern'] The value '' is not accepted by the " .
13-
"pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
13+
"pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
1414
"Element 'add', attribute 'action': '' is not a valid value of the atomic type 'typeAction'.\nLine: 1\n"
1515
],
1616
],
@@ -20,7 +20,7 @@
2020
'resource="Test_Value::value"/></menu></config>',
2121
[
2222
"Element 'add', attribute 'action': [facet 'pattern'] The value 'ad' is not accepted by the " .
23-
"pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
23+
"pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
2424
"Element 'add', attribute 'action': 'ad' is not a valid value of the atomic type 'typeAction'.\nLine: 1\n"
2525
],
2626
],
@@ -31,7 +31,7 @@
3131
'</menu></config>',
3232
[
3333
"Element 'add', attribute 'action': [facet 'pattern'] The value 'adm$#@inhtml/notification' is not " .
34-
"accepted by the pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
34+
"accepted by the pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
3535
"Element 'add', attribute 'action': 'adm$#@inhtml/notification' is not a valid value of the atomic " .
3636
"type 'typeAction'.\nLine: 1\n"
3737
],
@@ -452,7 +452,7 @@
452452
'<?xml version="1.0"?><config><menu><update action="" ' . 'id="Test_Value::some_value"/></menu></config>',
453453
[
454454
"Element 'update', attribute 'action': [facet 'pattern'] The value '' is not accepted by the " .
455-
"pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
455+
"pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
456456
"Element 'update', attribute 'action': '' is not a valid value of the atomic type 'typeAction'.\nLine: 1\n"
457457
],
458458
],
@@ -462,7 +462,7 @@
462462
'resource="Test_Value::value"/></menu></config>',
463463
[
464464
"Element 'update', attribute 'action': [facet 'pattern'] The value 'v' is not accepted by the " .
465-
"pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
465+
"pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
466466
"Element 'update', attribute 'action': 'v' is not a valid value of the atomic type 'typeAction'.\nLine: 1\n"
467467
],
468468
],
@@ -471,7 +471,7 @@
471471
'id="Test_Value::some_value"/></menu></config>',
472472
[
473473
"Element 'update', attribute 'action': [facet 'pattern'] The value '/@##gt;' is not " .
474-
"accepted by the pattern '[a-zA-Z0-9/_]{3,}'.\nLine: 1\n",
474+
"accepted by the pattern '[a-zA-Z0-9/_\-]{3,}'.\nLine: 1\n",
475475
"Element 'update', attribute 'action': '/@##gt;' is not a valid value of the atomic" .
476476
" type 'typeAction'.\nLine: 1\n"
477477
],

app/code/Magento/Backend/etc/menu.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
</xs:documentation>
101101
</xs:annotation>
102102
<xs:restriction base="xs:string">
103-
<xs:pattern value="[a-zA-Z0-9/_]{3,}" />
103+
<xs:pattern value="[a-zA-Z0-9/_\-]{3,}" />
104104
</xs:restriction>
105105
</xs:simpleType>
106106

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<?php $_selections = $_option->getSelections(); ?>
1111
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1212

13-
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required _required'; } ?>">
13+
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' _required'; } ?>">
1414
<label class="label admin__field-label">
1515
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
1616
</label>

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<?php $_option = $block->getOption(); ?>
1010
<?php $_selections = $_option->getSelections(); ?>
1111
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
12-
<div class="field admin__field <?php if ($_option->getRequired()) { echo ' required'; } ?><?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
12+
<div class="field admin__field <?php if ($_option->getRequired()) { echo ' _required'; } ?><?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
1313
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1414
<div class="control admin__field-control">
1515
<?php if (count($_selections) == 1 && $_option->getRequired()) : ?>

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1313
<?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?>
1414

15-
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required'; } ?>">
15+
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' _required'; } ?>">
1616
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1717
<div class="control admin__field-control">
1818
<div class="nested<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
@@ -39,7 +39,7 @@
3939
<?php foreach ($_selections as $_selection) : ?>
4040
<div class="field choice admin__field admin__field-option">
4141
<input type="radio"
42-
class="radio admin__control-radio <?= $_option->getRequired() ? ' validate-one-required-by-name' : '' ?> change-container-classname"
42+
class="radio admin__control-radio <?= $_option->getRequired() ? ' required-entry' : '' ?> change-container-classname"
4343
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
4444
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
4545
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
@@ -66,7 +66,7 @@
6666
</label>
6767
<div class="control admin__field-control"><input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
6868
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
69-
class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
69+
class="input-text admin__control-text qty validate-greater-than-zero<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
7070
type="text"
7171
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
7272
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" />

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1313
<?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?>
1414

15-
<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?><?php if ($_option->getRequired()) { echo ' required _required'; } ?>">
15+
<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?><?php if ($_option->getRequired()) { echo ' _required'; } ?>">
1616
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1717
<div class="control admin__field-control">
1818
<?php if ($block->showSingle()) : ?>
@@ -49,7 +49,7 @@
4949
<div class="control admin__field-control">
5050
<input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
5151
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
52-
class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
52+
class="input-text admin__control-text qty validate-greater-than-zero<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
5353
type="text"
5454
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
5555
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" />
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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\Captcha\Test\Unit\CustomerData;
10+
11+
use Magento\Captcha\Helper\Data as CaptchaHelper;
12+
use Magento\Customer\Model\Session as CustomerSession;
13+
use Magento\Captcha\CustomerData\Captcha;
14+
use Magento\Captcha\Model\DefaultModel;
15+
use Magento\Customer\Api\Data\CustomerInterface as CustomerData;
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
17+
use PHPUnit\Framework\TestCase;
18+
19+
class CaptchaTest extends TestCase
20+
{
21+
/**
22+
* @var CaptchaHelper|\PHPUnit_Framework_MockObject_MockObject
23+
*/
24+
private $helperMock;
25+
26+
/**
27+
* @var CustomerSession|\PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
private $customerSessionMock;
30+
31+
/**
32+
* @var Captcha
33+
*/
34+
private $model;
35+
36+
/**
37+
* @var array
38+
*/
39+
private $formIds;
40+
41+
/**
42+
* @var ObjectManagerHelper
43+
*/
44+
protected $objectManagerHelper;
45+
46+
/**
47+
* Create mocks and model
48+
*/
49+
protected function setUp()
50+
{
51+
$this->helperMock = $this->createMock(CaptchaHelper::class);
52+
$this->customerSessionMock = $this->createMock(CustomerSession::class);
53+
$this->formIds = [
54+
'user_login'
55+
];
56+
$this->objectManagerHelper = new ObjectManagerHelper($this);
57+
$this->model = $this->objectManagerHelper->getObject(
58+
Captcha::class,
59+
[
60+
'helper' => $this->helperMock,
61+
'formIds' => $this->formIds,
62+
'customerSession' => $this->customerSessionMock
63+
]
64+
);
65+
}
66+
67+
/**
68+
* Test getSectionData() when user is login and require captcha
69+
*/
70+
public function testGetSectionDataWhenLoginAndRequireCaptcha()
71+
{
72+
$emailLogin = 'test@localhost.com';
73+
74+
$userLoginModel = $this->createMock(DefaultModel::class);
75+
$userLoginModel->expects($this->any())->method('isRequired')->with($emailLogin)
76+
->willReturn(true);
77+
$this->helperMock->expects($this->any())->method('getCaptcha')->with('user_login')->willReturn($userLoginModel);
78+
79+
$this->customerSessionMock->expects($this->any())->method('isLoggedIn')
80+
->willReturn(true);
81+
82+
$customerDataMock = $this->createMock(CustomerData::class);
83+
$customerDataMock->expects($this->any())->method('getEmail')->willReturn($emailLogin);
84+
$this->customerSessionMock->expects($this->any())->method('getCustomerData')
85+
->willReturn($customerDataMock);
86+
87+
/* Assert to test */
88+
$this->assertEquals(
89+
[
90+
"user_login" => [
91+
"isRequired" => true,
92+
"timestamp" => time()
93+
]
94+
],
95+
$this->model->getSectionData()
96+
);
97+
}
98+
}

0 commit comments

Comments
 (0)