Skip to content

Commit 4bc880b

Browse files
#10045 Clean up sitemapTest
1 parent 6c137a8 commit 4bc880b

File tree

1 file changed

+8
-73
lines changed

1 file changed

+8
-73
lines changed

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

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -529,70 +529,20 @@ protected function _getModelMock($mockBeforeSave = false)
529529
$methods[] = 'beforeSave';
530530
}
531531

532-
$this->_sitemapCategoryMock->expects(
533-
$this->any()
534-
)->method(
535-
'getCollection'
536-
)->will(
537-
$this->returnValue(
538-
[
539-
new \Magento\Framework\DataObject(
540-
['url' => 'category.html', 'updated_at' => '2012-12-21 00:00:00']
541-
),
542-
new \Magento\Framework\DataObject(
543-
['url' => '/category/sub-category.html', 'updated_at' => '2012-12-21 00:00:00']
544-
),
545-
]
546-
)
547-
);
548-
549532
$storeBaseMediaUrl = 'http://store.com/pub/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff/';
550-
$this->_sitemapProductMock->expects(
551-
$this->any()
552-
)->method(
553-
'getCollection'
554-
)->will(
555-
$this->returnValue(
556-
[
557-
new \Magento\Framework\DataObject(
558-
['url' => 'product.html', 'updated_at' => '2012-12-21 00:00:00']
559-
),
560-
new \Magento\Framework\DataObject(
561-
[
562-
'url' => 'product2.html',
563-
'updated_at' => '2012-12-21 00:00:00',
564-
'images' => new \Magento\Framework\DataObject(
565-
[
566-
'collection' => [
567-
new \Magento\Framework\DataObject(
568-
[
569-
'url' => $storeBaseMediaUrl.'i/m/image1.png',
570-
'caption' => 'caption & > title < "'
571-
]
572-
),
573-
new \Magento\Framework\DataObject(
574-
['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null]
575-
),
576-
],
577-
'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg',
578-
'title' => 'Product & > title < "',
579-
]
580-
),
581-
]
582-
),
583-
]
584-
)
585-
);
586-
$this->_sitemapCmsPageMock->expects($this->any())->method('getCollection')->will($this->returnValue([]));
587533

588534
$this->itemResolverMock->expects(self::any())
589535
->method('getItems')
590536
->willReturn([
591537
new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'),
592538
new SitemapItem('/category/sub-category.html', '1.0', 'daily', '2012-12-21 00:00:00'),
593539
new SitemapItem('product.html', '0.5', 'monthly', '2012-12-21 00:00:00'),
594-
new SitemapItem('product2.html', '0.5', 'monthly', '2012-12-21 00:00:00', new \Magento\Framework\DataObject(
595-
[
540+
new SitemapItem(
541+
'product2.html',
542+
'0.5',
543+
'monthly',
544+
'2012-12-21 00:00:00',
545+
new \Magento\Framework\DataObject([
596546
'collection' => [
597547
new \Magento\Framework\DataObject(
598548
[
@@ -606,8 +556,8 @@ protected function _getModelMock($mockBeforeSave = false)
606556
],
607557
'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg',
608558
'title' => 'Product & > title < "',
609-
]
610-
))
559+
])
560+
)
611561
]);
612562

613563
/** @var $model \Magento\Sitemap\Model\Sitemap */
@@ -643,30 +593,15 @@ protected function _getModelConstructorArgs()
643593
{
644594
$categoryFactory = $this->getMockBuilder(
645595
\Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory::class
646-
)->setMethods(
647-
['create']
648596
)->disableOriginalConstructor()->getMock();
649-
$categoryFactory->expects(
650-
$this->any()
651-
)->method(
652-
'create'
653-
)->will(
654-
$this->returnValue($this->_sitemapCategoryMock)
655-
);
656597

657598
$productFactory = $this->getMockBuilder(
658599
\Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory::class
659-
)->setMethods(
660-
['create']
661600
)->disableOriginalConstructor()->getMock();
662-
$productFactory->expects($this->any())->method('create')->will($this->returnValue($this->_sitemapProductMock));
663601

664602
$cmsFactory = $this->getMockBuilder(
665603
\Magento\Sitemap\Model\ResourceModel\Cms\PageFactory::class
666-
)->setMethods(
667-
['create']
668604
)->disableOriginalConstructor()->getMock();
669-
$cmsFactory->expects($this->any())->method('create')->will($this->returnValue($this->_sitemapCmsPageMock));
670605

671606
$this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
672607
->setMethods(['getStore'])

0 commit comments

Comments
 (0)