Skip to content

Commit

Permalink
merge magento 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
solwininfotech committed Dec 24, 2019
2 parents 74cfd18 + 4165276 commit 505549b
Show file tree
Hide file tree
Showing 2,134 changed files with 49,961 additions and 19,097 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<field id="search_suggestion_enabled">1</field>
</depends>
</field>
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="search_suggestion_count_results_enabled" translate="label comment" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Results Count for Each Suggestion</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>When you enable this option your site may slow down.</comment>
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Analytics/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<label>Advanced Reporting</label>
<comment><![CDATA[This service provides a dynamic suite of reports with rich insights about your business.
Your reports can be accessed securely on a personalized dashboard outside of the admin panel by clicking on the
"Go to Advanced Reporting" link. </br> For more information, see our <a href="https://magento.com/legal/terms/cloud-terms">
"Go to Advanced Reporting" link. </br> For more information, see our <a target="_blank" href="https://magento.com/legal/terms/cloud-terms">
terms and conditions</a>.]]></comment>
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Advanced Reporting Service</label>
Expand All @@ -29,7 +29,7 @@
<frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel</frontend_model>
<backend_model>Magento\Analytics\Model\Config\Backend\CollectionTime</backend_model>
</field>
<field id="vertical" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="vertical" translate="hint label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<hint>Industry Data</hint>
<label>Industry</label>
<comment>In order to personalize your Advanced Reporting experience, please select your industry.</comment>
Expand Down
16 changes: 0 additions & 16 deletions app/code/Magento/AsynchronousOperations/Model/BulkStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@ public function getFailedOperationsByBulkId($bulkUuid, $failureType = null)
*/
public function getOperationsCountByBulkIdAndStatus($bulkUuid, $status)
{
if ($status === OperationInterface::STATUS_TYPE_OPEN) {
/**
* Total number of operations that has been scheduled within the given bulk
*/
$allOperationsQty = $this->getOperationCount($bulkUuid);

/**
* Number of operations that has been processed (i.e. operations with any status but 'open')
*/
$allProcessedOperationsQty = (int)$this->operationCollectionFactory->create()
->addFieldToFilter('bulk_uuid', $bulkUuid)
->getSize();

return $allOperationsQty - $allProcessedOperationsQty;
}

/** @var \Magento\AsynchronousOperations\Model\ResourceModel\Operation\Collection $collection */
$collection = $this->operationCollectionFactory->create();
return $collection->addFieldToFilter('bulk_uuid', $bulkUuid)
Expand Down
23 changes: 22 additions & 1 deletion app/code/Magento/AsynchronousOperations/Model/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@
namespace Magento\AsynchronousOperations\Model;

use Magento\AsynchronousOperations\Api\Data\OperationInterface;
use Magento\AsynchronousOperations\Model\OperationStatusValidator;
use Magento\Framework\DataObject;

/**
* Class Operation
* Class Operation encapsulates methods for Operation Model Object
*/
class Operation extends DataObject implements OperationInterface
{
/**
* @var OperationStatusValidator
*/
private $operationStatusValidator;

/**
* Operation constructor.
*
* @param OperationStatusValidator $operationStatusValidator
* @param array $data
*/
public function __construct(
OperationStatusValidator $operationStatusValidator,
array $data = []
) {
$this->operationStatusValidator = $operationStatusValidator;
parent::__construct($data);
}

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -106,6 +126,7 @@ public function getStatus()
*/
public function setStatus($status)
{
$this->operationStatusValidator->validate($status);
return $this->setData(self::STATUS, $status);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AsynchronousOperations\Model;

/**
* Class OperationStatusPool
*
* Pool of statuses that require validate
*/
class OperationStatusPool
{
/**
* @var array
*/
private $statuses;

/**
* @param array $statuses
*/
public function __construct(array $statuses = [])
{
$this->statuses = $statuses;
}

/**
* Retrieve statuses that require validate
*
* @return array
*/
public function getStatuses()
{
return $this->statuses;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AsynchronousOperations\Model;

use Magento\AsynchronousOperations\Model\OperationStatusPool;
use Magento\Framework\Exception\NoSuchEntityException;
use Doctrine\Instantiator\Exception\InvalidArgumentException;

/**
* Class OperationStatusValidator to validate operation status
*/
class OperationStatusValidator
{
/**
* @var OperationStatusPool
*/
private $operationStatusPool;

/**
* OperationStatusValidator constructor.
*
* @param OperationStatusPool $operationStatusPool
*/
public function __construct(OperationStatusPool $operationStatusPool)
{
$this->operationStatusPool = $operationStatusPool;
}

/**
* Validate method
*
* @param int $status
* @throws \InvalidArgumentException
* @return void
*/
public function validate($status)
{
$statuses = $this->operationStatusPool->getStatuses();

if (!in_array($status, $statuses)) {
throw new \InvalidArgumentException('Invalid Operation Status.');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AsynchronousOperations\Test\Unit\Model;

use Magento\AsynchronousOperations\Model\OperationStatusValidator;
use Magento\AsynchronousOperations\Model\Operation;
use Magento\AsynchronousOperations\Model\OperationStatusPool;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\TestCase;

/**
* Class OperationStatusValidatorTest implements logic for testing Operation::setStatus() method
*/
class OperationStatusValidatorTest extends TestCase
{
/**
* @var OperationStatusPool
*/
private $operationStatusPool;

/**
* @var OperationStatusValidator
*/
private $operationStatusValidator;

/**
* @var Operation
*/
private $operation;

protected function setUp()
{
$this->operationStatusPool = $this->getMockBuilder(OperationStatusPool::class)
->disableOriginalConstructor()
->getMock();

$objectManager = new ObjectManager($this);

$this->operationStatusValidator = $objectManager->getObject(
OperationStatusValidator::class,
[
'operationStatusPool' => $this->operationStatusPool
]
);

$this->operation = $objectManager->getObject(
Operation::class,
[
'operationStatusValidator' => $this->operationStatusValidator
]
);
}

/**
* @param string $status
* @param array $statusPool
* @param string $expectedResult
* @dataProvider dataProviderForTestSetStatus
*/
public function testSetStatus(
string $status,
array $statusPool,
string $expectedResult
) {
$this->operationStatusPool
->expects($this->any())
->method('getStatuses')
->willReturn($statusPool);

try {
$this->operation->setStatus($status);
$this->assertEquals($expectedResult, $this->operation->getStatus());
} catch (\Exception $exception) {
$this->assertEquals($expectedResult, $exception->getMessage());
}
}

/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function dataProviderForTestSetStatus()
{
return [
[
'status' => 0,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 'Invalid Operation Status.'
],
[
'status' => 1,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 1
],
[
'status' => 2,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 2
],
[
'status' => 3,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 3
],
[
'status' => 4,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 4
],
[
'status' => 5,
'statusPool' => [
'complete' => 1,
'retriablyFailed' => 2,
'notRetriablyFailed' => 3,
'open' => 4,
'rejected' => 5
],
'expectedResult' => 5
]
];
}
}
11 changes: 11 additions & 0 deletions app/code/Magento/AsynchronousOperations/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@
</argument>
</arguments>
</type>
<type name="Magento\AsynchronousOperations\Model\OperationStatusPool">
<arguments>
<argument name="statuses" xsi:type="array">
<item name="complete" xsi:type="string">1</item>
<item name="retriablyFailed" xsi:type="string">2</item>
<item name="notRetriablyFailed" xsi:type="string">3</item>
<item name="open" xsi:type="string">4</item>
<item name="rejected" xsi:type="string">5</item>
</argument>
</arguments>
</type>
<virtualType
name="Magento\AsynchronousOperations\Ui\Component\DataProvider"
type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<actionsColumn name="actions" class="\Magento\AsynchronousOperations\Ui\Component\Listing\Column\Actions">
<settings>
<indexField>id</indexField>
<label>Action</label>
<label translate="true">Action</label>
</settings>
</actionsColumn>
</columns>
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Backend/Block/System/Account/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function _prepareForm()
{
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function _prepareForm()
'name' => 'password',
'label' => __('New Password'),
'title' => __('New Password'),
'class' => 'validate-admin-password admin__control-text'
'class' => 'validate-admin-password'
]
);

Expand All @@ -124,7 +124,7 @@ protected function _prepareForm()
[
'name' => 'password_confirmation',
'label' => __('Password Confirmation'),
'class' => 'validate-cpassword admin__control-text'
'class' => 'validate-cpassword'
]
);

Expand Down Expand Up @@ -152,7 +152,7 @@ protected function _prepareForm()
'label' => __('Your Password'),
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
'title' => __('Your Password'),
'class' => 'validate-current-password required-entry admin__control-text',
'class' => 'validate-current-password required-entry',
'required' => true
]
);
Expand Down
Loading

0 comments on commit 505549b

Please sign in to comment.