Skip to content

Commit 505549b

Browse files
author
solwininfotech
committed
merge magento 2.3
2 parents 74cfd18 + 4165276 commit 505549b

File tree

2,134 files changed

+49961
-19097
lines changed

Some content is hidden

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

2,134 files changed

+49961
-19097
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<field id="search_suggestion_enabled">1</field>
6161
</depends>
6262
</field>
63-
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
63+
<field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
6464
<label>Show Results Count for Each Suggestion</label>
6565
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
6666
<comment>When you enable this option your site may slow down.</comment>

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

Lines changed: 2 additions & 2 deletions
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>
@@ -29,7 +29,7 @@
2929
<frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel</frontend_model>
3030
<backend_model>Magento\Analytics\Model\Config\Backend\CollectionTime</backend_model>
3131
</field>
32-
<field id="vertical" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
32+
<field id="vertical" translate="hint label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
3333
<hint>Industry Data</hint>
3434
<label>Industry</label>
3535
<comment>In order to personalize your Advanced Reporting experience, please select your industry.</comment>

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/AsynchronousOperations/Model/Operation.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,33 @@
66
namespace Magento\AsynchronousOperations\Model;
77

88
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
9+
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
910
use Magento\Framework\DataObject;
1011

1112
/**
12-
* Class Operation
13+
* Class Operation encapsulates methods for Operation Model Object
1314
*/
1415
class Operation extends DataObject implements OperationInterface
1516
{
17+
/**
18+
* @var OperationStatusValidator
19+
*/
20+
private $operationStatusValidator;
21+
22+
/**
23+
* Operation constructor.
24+
*
25+
* @param OperationStatusValidator $operationStatusValidator
26+
* @param array $data
27+
*/
28+
public function __construct(
29+
OperationStatusValidator $operationStatusValidator,
30+
array $data = []
31+
) {
32+
$this->operationStatusValidator = $operationStatusValidator;
33+
parent::__construct($data);
34+
}
35+
1636
/**
1737
* @inheritDoc
1838
*/
@@ -106,6 +126,7 @@ public function getStatus()
106126
*/
107127
public function setStatus($status)
108128
{
129+
$this->operationStatusValidator->validate($status);
109130
return $this->setData(self::STATUS, $status);
110131
}
111132

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AsynchronousOperations\Model;
7+
8+
/**
9+
* Class OperationStatusPool
10+
*
11+
* Pool of statuses that require validate
12+
*/
13+
class OperationStatusPool
14+
{
15+
/**
16+
* @var array
17+
*/
18+
private $statuses;
19+
20+
/**
21+
* @param array $statuses
22+
*/
23+
public function __construct(array $statuses = [])
24+
{
25+
$this->statuses = $statuses;
26+
}
27+
28+
/**
29+
* Retrieve statuses that require validate
30+
*
31+
* @return array
32+
*/
33+
public function getStatuses()
34+
{
35+
return $this->statuses;
36+
}
37+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AsynchronousOperations\Model;
7+
8+
use Magento\AsynchronousOperations\Model\OperationStatusPool;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Doctrine\Instantiator\Exception\InvalidArgumentException;
11+
12+
/**
13+
* Class OperationStatusValidator to validate operation status
14+
*/
15+
class OperationStatusValidator
16+
{
17+
/**
18+
* @var OperationStatusPool
19+
*/
20+
private $operationStatusPool;
21+
22+
/**
23+
* OperationStatusValidator constructor.
24+
*
25+
* @param OperationStatusPool $operationStatusPool
26+
*/
27+
public function __construct(OperationStatusPool $operationStatusPool)
28+
{
29+
$this->operationStatusPool = $operationStatusPool;
30+
}
31+
32+
/**
33+
* Validate method
34+
*
35+
* @param int $status
36+
* @throws \InvalidArgumentException
37+
* @return void
38+
*/
39+
public function validate($status)
40+
{
41+
$statuses = $this->operationStatusPool->getStatuses();
42+
43+
if (!in_array($status, $statuses)) {
44+
throw new \InvalidArgumentException('Invalid Operation Status.');
45+
}
46+
}
47+
}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AsynchronousOperations\Test\Unit\Model;
7+
8+
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
9+
use Magento\AsynchronousOperations\Model\Operation;
10+
use Magento\AsynchronousOperations\Model\OperationStatusPool;
11+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
12+
use PHPUnit\Framework\TestCase;
13+
14+
/**
15+
* Class OperationStatusValidatorTest implements logic for testing Operation::setStatus() method
16+
*/
17+
class OperationStatusValidatorTest extends TestCase
18+
{
19+
/**
20+
* @var OperationStatusPool
21+
*/
22+
private $operationStatusPool;
23+
24+
/**
25+
* @var OperationStatusValidator
26+
*/
27+
private $operationStatusValidator;
28+
29+
/**
30+
* @var Operation
31+
*/
32+
private $operation;
33+
34+
protected function setUp()
35+
{
36+
$this->operationStatusPool = $this->getMockBuilder(OperationStatusPool::class)
37+
->disableOriginalConstructor()
38+
->getMock();
39+
40+
$objectManager = new ObjectManager($this);
41+
42+
$this->operationStatusValidator = $objectManager->getObject(
43+
OperationStatusValidator::class,
44+
[
45+
'operationStatusPool' => $this->operationStatusPool
46+
]
47+
);
48+
49+
$this->operation = $objectManager->getObject(
50+
Operation::class,
51+
[
52+
'operationStatusValidator' => $this->operationStatusValidator
53+
]
54+
);
55+
}
56+
57+
/**
58+
* @param string $status
59+
* @param array $statusPool
60+
* @param string $expectedResult
61+
* @dataProvider dataProviderForTestSetStatus
62+
*/
63+
public function testSetStatus(
64+
string $status,
65+
array $statusPool,
66+
string $expectedResult
67+
) {
68+
$this->operationStatusPool
69+
->expects($this->any())
70+
->method('getStatuses')
71+
->willReturn($statusPool);
72+
73+
try {
74+
$this->operation->setStatus($status);
75+
$this->assertEquals($expectedResult, $this->operation->getStatus());
76+
} catch (\Exception $exception) {
77+
$this->assertEquals($expectedResult, $exception->getMessage());
78+
}
79+
}
80+
81+
/**
82+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
83+
*/
84+
public function dataProviderForTestSetStatus()
85+
{
86+
return [
87+
[
88+
'status' => 0,
89+
'statusPool' => [
90+
'complete' => 1,
91+
'retriablyFailed' => 2,
92+
'notRetriablyFailed' => 3,
93+
'open' => 4,
94+
'rejected' => 5
95+
],
96+
'expectedResult' => 'Invalid Operation Status.'
97+
],
98+
[
99+
'status' => 1,
100+
'statusPool' => [
101+
'complete' => 1,
102+
'retriablyFailed' => 2,
103+
'notRetriablyFailed' => 3,
104+
'open' => 4,
105+
'rejected' => 5
106+
],
107+
'expectedResult' => 1
108+
],
109+
[
110+
'status' => 2,
111+
'statusPool' => [
112+
'complete' => 1,
113+
'retriablyFailed' => 2,
114+
'notRetriablyFailed' => 3,
115+
'open' => 4,
116+
'rejected' => 5
117+
],
118+
'expectedResult' => 2
119+
],
120+
[
121+
'status' => 3,
122+
'statusPool' => [
123+
'complete' => 1,
124+
'retriablyFailed' => 2,
125+
'notRetriablyFailed' => 3,
126+
'open' => 4,
127+
'rejected' => 5
128+
],
129+
'expectedResult' => 3
130+
],
131+
[
132+
'status' => 4,
133+
'statusPool' => [
134+
'complete' => 1,
135+
'retriablyFailed' => 2,
136+
'notRetriablyFailed' => 3,
137+
'open' => 4,
138+
'rejected' => 5
139+
],
140+
'expectedResult' => 4
141+
],
142+
[
143+
'status' => 5,
144+
'statusPool' => [
145+
'complete' => 1,
146+
'retriablyFailed' => 2,
147+
'notRetriablyFailed' => 3,
148+
'open' => 4,
149+
'rejected' => 5
150+
],
151+
'expectedResult' => 5
152+
]
153+
];
154+
}
155+
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@
8080
</argument>
8181
</arguments>
8282
</type>
83+
<type name="Magento\AsynchronousOperations\Model\OperationStatusPool">
84+
<arguments>
85+
<argument name="statuses" xsi:type="array">
86+
<item name="complete" xsi:type="string">1</item>
87+
<item name="retriablyFailed" xsi:type="string">2</item>
88+
<item name="notRetriablyFailed" xsi:type="string">3</item>
89+
<item name="open" xsi:type="string">4</item>
90+
<item name="rejected" xsi:type="string">5</item>
91+
</argument>
92+
</arguments>
93+
</type>
8394
<virtualType
8495
name="Magento\AsynchronousOperations\Ui\Component\DataProvider"
8596
type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/>

app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<actionsColumn name="actions" class="\Magento\AsynchronousOperations\Ui\Component\Listing\Column\Actions">
9393
<settings>
9494
<indexField>id</indexField>
95-
<label>Action</label>
95+
<label translate="true">Action</label>
9696
</settings>
9797
</actionsColumn>
9898
</columns>

app/code/Magento/Backend/Block/System/Account/Edit/Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(
6868
}
6969

7070
/**
71-
* {@inheritdoc}
71+
* @inheritdoc
7272
*/
7373
protected function _prepareForm()
7474
{
@@ -114,7 +114,7 @@ protected function _prepareForm()
114114
'name' => 'password',
115115
'label' => __('New Password'),
116116
'title' => __('New Password'),
117-
'class' => 'validate-admin-password admin__control-text'
117+
'class' => 'validate-admin-password'
118118
]
119119
);
120120

@@ -124,7 +124,7 @@ protected function _prepareForm()
124124
[
125125
'name' => 'password_confirmation',
126126
'label' => __('Password Confirmation'),
127-
'class' => 'validate-cpassword admin__control-text'
127+
'class' => 'validate-cpassword'
128128
]
129129
);
130130

@@ -152,7 +152,7 @@ protected function _prepareForm()
152152
'label' => __('Your Password'),
153153
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
154154
'title' => __('Your Password'),
155-
'class' => 'validate-current-password required-entry admin__control-text',
155+
'class' => 'validate-current-password required-entry',
156156
'required' => true
157157
]
158158
);

0 commit comments

Comments
 (0)