Skip to content

Commit 8f7085f

Browse files
committed
Adjustments according review
1 parent e694954 commit 8f7085f

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

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

Lines changed: 2 additions & 2 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
/**

app/code/Magento/MediaGallery/Test/Unit/Model/Keyword/Command/GetAssetKeywordsTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ class GetAssetKeywordsTest extends TestCase
4141
/**
4242
* @var LoggerInterface|MockObject
4343
*/
44-
private $logger;
44+
private $loggerMock;
4545

4646
protected function setUp(): void
4747
{
4848
$this->resourceConnectionStub = $this->createMock(ResourceConnection::class);
4949
$this->assetKeywordFactoryStub = $this->createMock(KeywordInterfaceFactory::class);
50-
$this->logger = $this->createMock(LoggerInterface::class);
50+
$this->loggerMock = $this->createMock(LoggerInterface::class);
5151

5252
$this->sut = new GetAssetKeywords(
5353
$this->resourceConnectionStub,
5454
$this->assetKeywordFactoryStub,
55-
$this->logger
55+
$this->loggerMock
5656
);
5757
}
5858

@@ -62,7 +62,6 @@ protected function setUp(): void
6262
* @dataProvider casesProvider()
6363
* @param array $databaseQueryResult
6464
* @param int $expectedNumberOfFoundKeywords
65-
* @throws NotFoundException
6665
*/
6766
public function testFind(array $databaseQueryResult, int $expectedNumberOfFoundKeywords): void
6867
{
@@ -104,7 +103,7 @@ public function testNotFoundBecauseOfError(): void
104103
->willThrowException((new \Exception()));
105104

106105
$this->expectException(IntegrationException::class);
107-
$this->logger->expects($this->once())
106+
$this->loggerMock->expects($this->once())
108107
->method('critical')
109108
->willReturnSelf();
110109

app/code/Magento/MediaGallery/Test/Unit/Model/Keyword/Command/SaveAssetKeywordsTest.php

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

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

10-
use Magento\MediaGallery\Model\Keyword\Command\SaveAssetKeywords;
11-
use Magento\MediaGallery\Model\Keyword\Command\SaveAssetLinks;
1210
use Magento\Framework\App\ResourceConnection;
1311
use Magento\Framework\DataObject;
1412
use Magento\Framework\DB\Adapter\Pdo\Mysql;
1513
use Magento\Framework\DB\Select;
1614
use Magento\Framework\Exception\CouldNotSaveException;
15+
use Magento\MediaGallery\Model\Keyword\Command\SaveAssetKeywords;
16+
use Magento\MediaGallery\Model\Keyword\Command\SaveAssetLinks;
1717
use PHPUnit\Framework\MockObject\MockObject;
1818
use PHPUnit\Framework\TestCase;
1919
use Psr\Log\LoggerInterface;
@@ -51,7 +51,7 @@ class SaveAssetKeywordsTest extends TestCase
5151
/**
5252
* @var LoggerInterface|MockObject
5353
*/
54-
private $logger;
54+
private $loggerMock;
5555

5656
/**
5757
* SetUp
@@ -64,12 +64,12 @@ public function setUp(): void
6464
->disableOriginalConstructor()
6565
->getMock();
6666
$this->selectMock = $this->createMock(Select::class);
67-
$this->logger = $this->createMock(LoggerInterface::class);
67+
$this->loggerMock = $this->createMock(LoggerInterface::class);
6868

6969
$this->sut = new SaveAssetKeywords(
7070
$this->resourceConnectionMock,
7171
$this->saveAssetLinksMock,
72-
$this->logger
72+
$this->loggerMock
7373
);
7474
}
7575

@@ -114,7 +114,7 @@ public function testAssetNotSavingCausedByError(): void
114114
->method('getConnection')
115115
->willThrowException((new \Exception()));
116116
$this->expectException(CouldNotSaveException::class);
117-
$this->logger->expects($this->once())
117+
$this->loggerMock->expects($this->once())
118118
->method('critical')
119119
->willReturnSelf();
120120

app/code/Magento/MediaGallery/Test/Unit/Model/Keyword/Command/SaveAssetLinksTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SaveAssetLinksTest extends TestCase
3838
/**
3939
* @var LoggerInterface|MockObject
4040
*/
41-
private $logger;
41+
private $loggerMock;
4242

4343
/**
4444
* Prepare test objects.
@@ -47,11 +47,11 @@ public function setUp(): void
4747
{
4848
$this->connectionMock = $this->createMock(AdapterInterface::class);
4949
$this->resourceConnectionMock = $this->createMock(ResourceConnection::class);
50-
$this->logger = $this->createMock(LoggerInterface::class);
50+
$this->loggerMock = $this->createMock(LoggerInterface::class);
5151

5252
$this->sut = new SaveAssetLinks(
5353
$this->resourceConnectionMock,
54-
$this->logger
54+
$this->loggerMock
5555
);
5656
}
5757

@@ -63,8 +63,6 @@ public function setUp(): void
6363
* @param int $assetId
6464
* @param array $keywordIds
6565
* @param array $values
66-
*
67-
* @throws CouldNotSaveException
6866
*/
6967
public function testAssetKeywordsSave(int $assetId, array $keywordIds, array $values): void
7068
{
@@ -105,7 +103,7 @@ public function testAssetNotSavingCausedByError(): void
105103
->method('insertArray')
106104
->willThrowException((new \Exception()));
107105
$this->expectException(CouldNotSaveException::class);
108-
$this->logger->expects($this->once())
106+
$this->loggerMock->expects($this->once())
109107
->method('critical')
110108
->willReturnSelf();
111109

0 commit comments

Comments
 (0)