Skip to content

Commit e84483d

Browse files
merge magento/2.3-develop into magento-tsg/2.3-develop-pr96
2 parents 60ed22a + 121fadd commit e84483d

File tree

27 files changed

+347
-78
lines changed

27 files changed

+347
-78
lines changed

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/Customer/Controller/Account/LoginPost.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ public function execute()
204204
'This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.',
205205
$value
206206
);
207-
} catch (UserLockedException $e) {
208-
$message = __(
209-
'The account sign-in was incorrect or your account is disabled temporarily. '
210-
. 'Please wait and try again later.'
211-
);
212207
} catch (AuthenticationException $e) {
213208
$message = __(
214209
'The account sign-in was incorrect or your account is disabled temporarily. '

app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminDeleteCustomerGroupActionGroup.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<arguments>
1616
<argument name="customerGroupName" type="string"/>
1717
</arguments>
18-
18+
1919
<amOnPage url="{{AdminCustomerGroupsIndexPage.url}}" stepKey="goToAdminCustomerGroupIndexPage"/>
2020
<waitForPageLoad time="30" stepKey="waitForCustomerGroupIndexPageLoad"/>
2121
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomerGroupIndexPage"/>
@@ -24,6 +24,8 @@
2424
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
2525
<click selector="{{AdminCustomerGroupGridActionsSection.selectButton(customerGroupName)}}" stepKey="clickSelectButton"/>
2626
<click selector="{{AdminCustomerGroupGridActionsSection.deleteAction(customerGroupName)}}" stepKey="clickOnDeleteItem"/>
27+
<waitForElementVisible selector="{{AdminGridConfirmActionSection.message}}" stepKey="waitForConfirmModal"/>
28+
<see selector="{{AdminGridConfirmActionSection.message}}" userInput="Are you sure you want to delete a {{customerGroupName}} record?" stepKey="seeRemoveMessage"/>
2729
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDeleteCustomerGroup"/>
2830
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
2931
</actionGroup>

app/code/Magento/Customer/Test/Mftf/Data/CustomerGroupData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</array>
3131
</entity>
3232
<entity name="CustomCustomerGroup" type="customerGroup">
33-
<data key="code" unique="suffix">Group </data>
33+
<data key="code" unique="suffix">Group-</data>
3434
<data key="tax_class_id">3</data>
3535
<data key="tax_class_name">Retail Customer</data>
3636
</entity>

app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public function prepareDataSource(array $dataSource)
9797
),
9898
'label' => __('Delete'),
9999
'confirm' => [
100-
'title' => __('Delete %1', $this->escaper->escapeJs($title)),
100+
'title' => __('Delete %1', $this->escaper->escapeHtml($title)),
101101
'message' => __(
102102
'Are you sure you want to delete a %1 record?',
103-
$this->escaper->escapeJs($title)
103+
$this->escaper->escapeHtml($title)
104104
)
105105
],
106106
'post' => true,
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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\Downloadable\Test\Unit\Ui\DataProvider\Product\Form\Modifier\Data;
9+
10+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
11+
use Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Data\Samples;
12+
use \Magento\Framework\Escaper;
13+
use Magento\Downloadable\Model\Product\Type;
14+
use Magento\Catalog\Model\Locator\LocatorInterface;
15+
use Magento\Framework\App\Config\ScopeConfigInterface;
16+
use Magento\Downloadable\Helper\File as DownloadableFile;
17+
use Magento\Framework\UrlInterface;
18+
use Magento\Catalog\Api\Data\ProductInterface;
19+
20+
/**
21+
* Test class to cover Sample Modifier
22+
*
23+
* Class \Magento\Downloadable\Test\Unit\Ui\DataProvider\Product\Form\Modifier\Data\SampleTest
24+
*/
25+
class SamplesTest extends \PHPUnit\Framework\TestCase
26+
{
27+
/**
28+
* @var ObjectManagerHelper
29+
*/
30+
private $objectManagerHelper;
31+
32+
/**
33+
* @var LocatorInterface|\PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
private $locatorMock;
36+
37+
/**
38+
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $scopeConfigMock;
41+
42+
/**
43+
* @var Escaper|\PHPUnit_Framework_MockObject_MockObject
44+
*/
45+
private $escaperMock;
46+
47+
/**
48+
* @var DownloadableFile|\PHPUnit_Framework_MockObject_MockObject
49+
*/
50+
private $downloadableFileMock;
51+
52+
/**
53+
* @var UrlInterface|\PHPUnit_Framework_MockObject_MockObject
54+
*/
55+
private $urlBuilderMock;
56+
57+
/**
58+
* @var ProductInterface|\PHPUnit_Framework_MockObject_MockObject
59+
*/
60+
private $productMock;
61+
62+
/**
63+
* @var Samples
64+
*/
65+
private $samples;
66+
67+
/**
68+
* @return void
69+
*/
70+
protected function setUp()
71+
{
72+
$this->objectManagerHelper = new ObjectManagerHelper($this);
73+
$this->productMock = $this->getMockBuilder(ProductInterface::class)
74+
->setMethods(['getSamplesTitle', 'getId', 'getTypeId'])
75+
->getMockForAbstractClass();
76+
$this->locatorMock = $this->createMock(LocatorInterface::class);
77+
$this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
78+
$this->escaperMock = $this->createMock(Escaper::class);
79+
$this->downloadableFileMock = $this->createMock(DownloadableFile::class);
80+
$this->urlBuilderMock = $this->createMock(UrlInterface::class);
81+
$this->samples = $this->objectManagerHelper->getObject(
82+
Samples::class,
83+
[
84+
'escaper' => $this->escaperMock,
85+
'locator' => $this->locatorMock,
86+
'scopeConfig' => $this->scopeConfigMock,
87+
'downloadableFile' => $this->downloadableFileMock,
88+
'urlBuilder' => $this->urlBuilderMock
89+
]
90+
);
91+
}
92+
93+
/**
94+
* Test getSamplesTitle()
95+
*
96+
* @param int|null $id
97+
* @param string $typeId
98+
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetTitle
99+
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetValue
100+
* @return void
101+
* @dataProvider getSamplesTitleDataProvider
102+
*/
103+
public function testGetSamplesTitle($id, $typeId, $expectedGetTitle, $expectedGetValue)
104+
{
105+
$title = 'My Title';
106+
$this->locatorMock->expects($this->any())
107+
->method('getProduct')
108+
->willReturn($this->productMock);
109+
$this->productMock->expects($this->once())
110+
->method('getId')
111+
->willReturn($id);
112+
$this->productMock->expects($this->any())
113+
->method('getTypeId')
114+
->willReturn($typeId);
115+
$this->productMock->expects($expectedGetTitle)
116+
->method('getSamplesTitle')
117+
->willReturn($title);
118+
$this->scopeConfigMock->expects($expectedGetValue)
119+
->method('getValue')
120+
->willReturn($title);
121+
122+
/* Assert Result */
123+
$this->assertEquals($title, $this->samples->getSamplesTitle());
124+
}
125+
126+
/**
127+
* @return array
128+
*/
129+
public function getSamplesTitleDataProvider()
130+
{
131+
return [
132+
[
133+
'id' => 1,
134+
'typeId' => Type::TYPE_DOWNLOADABLE,
135+
'expectedGetTitle' => $this->once(),
136+
'expectedGetValue' => $this->never(),
137+
],
138+
[
139+
'id' => null,
140+
'typeId' => Type::TYPE_DOWNLOADABLE,
141+
'expectedGetTitle' => $this->never(),
142+
'expectedGetValue' => $this->once(),
143+
],
144+
[
145+
'id' => 1,
146+
'typeId' => 'someType',
147+
'expectedGetTitle' => $this->never(),
148+
'expectedGetValue' => $this->once(),
149+
],
150+
[
151+
'id' => null,
152+
'typeId' => 'someType',
153+
'expectedGetTitle' => $this->never(),
154+
'expectedGetValue' => $this->once(),
155+
],
156+
];
157+
}
158+
}

app/code/Magento/MediaGallery/Model/Asset/Command/DeleteByPath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Magento\MediaGallery\Model\Asset\Command;
99

10-
use Magento\MediaGalleryApi\Model\Asset\Command\DeleteByPathInterface;
1110
use Magento\Framework\App\ResourceConnection;
12-
use Magento\Framework\Exception\CouldNotDeleteException;
1311
use Magento\Framework\DB\Adapter\AdapterInterface;
12+
use Magento\Framework\Exception\CouldNotDeleteException;
13+
use Magento\MediaGalleryApi\Model\Asset\Command\DeleteByPathInterface;
1414
use Psr\Log\LoggerInterface;
1515

1616
/**
@@ -62,11 +62,11 @@ public function execute(string $mediaAssetPath): void
6262
$tableName = $this->resourceConnection->getTableName(self::TABLE_MEDIA_GALLERY_ASSET);
6363
$connection->delete($tableName, [self::MEDIA_GALLERY_ASSET_PATH . ' = ?' => $mediaAssetPath]);
6464
} catch (\Exception $exception) {
65+
$this->logger->critical($exception);
6566
$message = __(
6667
'Could not delete media asset with path %path: %error',
6768
['path' => $mediaAssetPath, 'error' => $exception->getMessage()]
6869
);
69-
$this->logger->critical($message);
7070
throw new CouldNotDeleteException($message, $exception);
7171
}
7272
}

app/code/Magento/MediaGallery/Model/Asset/Command/GetById.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,23 @@ public function execute(int $mediaAssetId): AssetInterface
7373
->where('amg.id = ?', $mediaAssetId);
7474
$mediaAssetData = $connection->query($select)->fetch();
7575
} catch (\Exception $exception) {
76+
$this->logger->critical($exception);
7677
$message = __(
7778
'En error occurred during get media asset data by id %id: %error',
7879
['id' => $mediaAssetId, 'error' => $exception->getMessage()]
7980
);
80-
$this->logger->critical($message);
8181
throw new IntegrationException($message, $exception);
8282
}
8383

8484
if (empty($mediaAssetData)) {
85-
$message = __('There is no such media asset with id "%1"', $mediaAssetId);
85+
$message = __('There is no such media asset with id %id', ['id' => $mediaAssetId]);
8686
throw new NoSuchEntityException($message);
8787
}
8888

8989
try {
9090
return $this->assetFactory->create(['data' => $mediaAssetData]);
9191
} catch (\Exception $exception) {
92-
$this->logger->critical($exception->getMessage());
92+
$this->logger->critical($exception);
9393
$message = __(
9494
'En error occurred during initialize media asset with id %id: %error',
9595
['id' => $mediaAssetId, 'error' => $exception->getMessage()]

app/code/Magento/MediaGallery/Model/Asset/Command/GetByPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public function execute(string $mediaFilePath): AssetInterface
8282

8383
return $mediaAssets;
8484
} catch (\Exception $exception) {
85+
$this->logger->critical($exception);
8586
$message = __('An error occurred during get media asset list: %1', $exception->getMessage());
86-
$this->logger->critical($message);
8787
throw new IntegrationException($message, $exception);
8888
}
8989
}

app/code/Magento/MediaGallery/Model/Asset/Command/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public function execute(AssetInterface $mediaAsset): int
7171
$connection->insertOnDuplicate($tableName, $this->extractor->extract($mediaAsset, AssetInterface::class));
7272
return (int) $connection->lastInsertId($tableName);
7373
} catch (\Exception $exception) {
74+
$this->logger->critical($exception);
7475
$message = __('An error occurred during media asset save: %1', $exception->getMessage());
75-
$this->logger->critical($message);
7676
throw new CouldNotSaveException($message, $exception);
7777
}
7878
}

app/code/Magento/MediaGallery/Model/DataExtractor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
class DataExtractor implements DataExtractorInterface
1616
{
1717
/**
18-
* @inheritdoc
18+
* Extract data from an object using available getters (does not process extension attributes)
19+
*
20+
* @param object $object
21+
* @param string|null $interface
22+
*
23+
* @return array
24+
* @throws \ReflectionException
1925
*/
2026
public function extract($object, string $interface = null): array
2127
{

app/code/Magento/MediaGallery/Model/Keyword/Command/GetAssetKeywords.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
namespace Magento\MediaGallery\Model\Keyword\Command;
99

10+
use Magento\Framework\Exception\IntegrationException;
1011
use Magento\MediaGalleryApi\Api\Data\KeywordInterface;
1112
use Magento\MediaGalleryApi\Api\Data\KeywordInterfaceFactory;
1213
use Magento\MediaGalleryApi\Model\Keyword\Command\GetAssetKeywordsInterface;
1314
use Magento\Framework\App\ResourceConnection;
14-
use Magento\Framework\Exception\NotFoundException;
15+
use Psr\Log\LoggerInterface;
1516

1617
/**
1718
* ClassGetAssetKeywords
@@ -31,27 +32,35 @@ class GetAssetKeywords implements GetAssetKeywordsInterface
3132
*/
3233
private $assetKeywordFactory;
3334

35+
/**
36+
* @var LoggerInterface
37+
*/
38+
private $logger;
39+
3440
/**
3541
* GetAssetKeywords constructor.
3642
*
3743
* @param ResourceConnection $resourceConnection
3844
* @param KeywordInterfaceFactory $assetKeywordFactory
45+
* @param LoggerInterface $logger
3946
*/
4047
public function __construct(
4148
ResourceConnection $resourceConnection,
42-
KeywordInterfaceFactory $assetKeywordFactory
49+
KeywordInterfaceFactory $assetKeywordFactory,
50+
LoggerInterface $logger
4351
) {
4452
$this->resourceConnection = $resourceConnection;
4553
$this->assetKeywordFactory = $assetKeywordFactory;
54+
$this->logger = $logger;
4655
}
4756

4857
/**
4958
* Get asset related keywords.
5059
*
5160
* @param int $assetId
5261
*
53-
* @return KeywordInterface[]
54-
* @throws NotFoundException
62+
* @return KeywordInterface[]|[]
63+
* @throws IntegrationException
5564
*/
5665
public function execute(int $assetId): array
5766
{
@@ -71,8 +80,9 @@ public function execute(int $assetId): array
7180

7281
return $keywords;
7382
} catch (\Exception $exception) {
83+
$this->logger->critical($exception);
7484
$message = __('An error occurred during get asset keywords: %1', $exception->getMessage());
75-
throw new NotFoundException($message, $exception);
85+
throw new IntegrationException($message, $exception);
7686
}
7787
}
7888
}

0 commit comments

Comments
 (0)