Skip to content

Commit fc8573e

Browse files
author
silinmykola
committed
fixes after a CR
1 parent 165080a commit fc8573e

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,34 +139,30 @@ protected function setUp(): void
139139
->disableOriginalConstructor()
140140
->getMock();
141141

142-
$this->resourceMock->expects($this->any())
143-
->method('addCommitCallback')
142+
$this->resourceMock->method('addCommitCallback')
144143
->willReturnSelf();
145144

146145
$this->fileMock = $this->createMock(Write::class);
147146

148147
$this->directoryMock = $this->createMock(DirectoryWrite::class);
149148

150-
$this->directoryMock->expects($this->any())
151-
->method('openFile')
149+
$this->directoryMock->method('openFile')
152150
->willReturn($this->fileMock);
153151

154152
$this->filesystemMock = $this->getMockBuilder(Filesystem::class)
155153
->setMethods(['getDirectoryWrite'])
156154
->disableOriginalConstructor()
157155
->getMock();
158156

159-
$this->filesystemMock->expects($this->any())
160-
->method('getDirectoryWrite')
157+
$this->filesystemMock->method('getDirectoryWrite')
161158
->willReturn($this->directoryMock);
162159

163160
$this->configReaderMock = $this->getMockForAbstractClass(SitemapConfigReaderInterface::class);
164161
$this->itemProviderMock = $this->getMockForAbstractClass(ItemProviderInterface::class);
165162
$this->request = $this->createMock(Http::class);
166163
$this->store = $this->createPartialMock(Store::class, ['isFrontUrlSecure', 'getBaseUrl']);
167164
$this->storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
168-
$this->storeManagerMock->expects($this->any())
169-
->method('getStore')
165+
$this->storeManagerMock->method('getStore')
170166
->willReturn($this->store);
171167
}
172168

@@ -467,12 +463,10 @@ function ($from, $to) {
467463
if (isset($robotsInfo['robotsFinish'])) {
468464
$robotsFinish = $robotsInfo['robotsFinish'];
469465
}
470-
$this->directoryMock->expects($this->any())
471-
->method('readFile')
466+
$this->directoryMock->method('readFile')
472467
->willReturn($robotsStart);
473468

474-
$this->directoryMock->expects($this->any())
475-
->method('writeFile')
469+
$this->directoryMock->method('writeFile')
476470
->with(
477471
$this->equalTo('robots.txt'),
478472
$this->equalTo($robotsFinish)
@@ -483,16 +477,13 @@ function ($from, $to) {
483477
if (isset($robotsInfo['pushToRobots'])) {
484478
$pushToRobots = (int)$robotsInfo['pushToRobots'];
485479
}
486-
$this->configReaderMock->expects($this->any())
487-
->method('getMaximumLinesNumber')
480+
$this->configReaderMock->method('getMaximumLinesNumber')
488481
->willReturn($maxLines);
489482

490-
$this->configReaderMock->expects($this->any())
491-
->method('getMaximumFileSize')
483+
$this->configReaderMock->method('getMaximumFileSize')
492484
->willReturn($maxFileSize);
493485

494-
$this->configReaderMock->expects($this->any())
495-
->method('getEnableSubmissionRobots')
486+
$this->configReaderMock->method('getEnableSubmissionRobots')
496487
->willReturn($pushToRobots);
497488

498489
$model = $this->getModelMock(true);
@@ -535,8 +526,7 @@ protected function getModelMock($mockBeforeSave = false)
535526

536527
$storeBaseMediaUrl = 'http://store.com/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff/';
537528

538-
$this->itemProviderMock->expects($this->any())
539-
->method('getItems')
529+
$this->itemProviderMock->method('getItems')
540530
->willReturn(
541531
[
542532
new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'),
@@ -659,16 +649,13 @@ public function testGetSitemapUrl($storeBaseUrl, $documentRoot, $baseDir, $sitem
659649
->setConstructorArgs($this->getModelConstructorArgs())
660650
->getMock();
661651

662-
$model->expects($this->any())
663-
->method('_getStoreBaseUrl')
652+
$model->method('_getStoreBaseUrl')
664653
->willReturn($storeBaseUrl);
665654

666-
$model->expects($this->any())
667-
->method('_getDocumentRoot')
655+
$model->method('_getDocumentRoot')
668656
->willReturn($documentRoot);
669657

670-
$model->expects($this->any())
671-
->method('_getBaseDir')
658+
$model->method('_getBaseDir')
672659
->willReturn($baseDir);
673660

674661
$this->assertEquals($result, $model->getSitemapUrl($sitemapPath, $sitemapFileName));

0 commit comments

Comments
 (0)