Skip to content

Commit 5484115

Browse files
author
Maxim Medinskiy
committed
MAGETWO-35088: Page and Block Data and Repository Interfaces
1 parent b8f6300 commit 5484115

File tree

1 file changed

+7
-31
lines changed
  • app/code/Magento/Cms/Test/Unit/Model/Config/Source

1 file changed

+7
-31
lines changed

app/code/Magento/Cms/Test/Unit/Model/Config/Source/PageTest.php

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@
1111
class PageTest extends \PHPUnit_Framework_TestCase
1212
{
1313
/**
14-
* @var \Magento\Cms\Model\PageRepository|\PHPUnit_Framework_MockObject_MockObject
14+
* @var \Magento\Cms\Model\Resource\Page\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
1515
*/
16-
protected $pageRepositoryMock;
17-
18-
/**
19-
* @var \Magento\Cms\Model\Resource\PageCriteria|\PHPUnit_Framework_MockObject_MockObject
20-
*/
21-
protected $pageCriteriaFactoryMock;
16+
protected $collectionFactory;
2217

2318
/**
2419
* @var \Magento\Cms\Model\Config\Source\Page
@@ -34,15 +29,8 @@ protected function setUp()
3429
{
3530
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
3631

37-
$this->pageRepositoryMock = $this->getMock(
38-
'Magento\Cms\Model\PageRepository',
39-
[],
40-
[],
41-
'',
42-
false
43-
);
44-
$this->pageCriteriaFactoryMock = $this->getMock(
45-
'\Magento\Framework\Api\SearchCriteriaInterfaceFactory',
32+
$this->collectionFactory = $this->getMock(
33+
'Magento\Cms\Model\Resource\Page\CollectionFactory',
4634
['create'],
4735
[],
4836
'',
@@ -52,8 +40,7 @@ protected function setUp()
5240
$this->page = $objectManager->getObject(
5341
'Magento\Cms\Model\Config\Source\Page',
5442
[
55-
'pageRepository' => $this->pageRepositoryMock,
56-
'pageCriteriaFactory' => $this->pageCriteriaFactoryMock
43+
'collectionFactory' => $this->collectionFactory,
5744
]
5845
);
5946
}
@@ -72,21 +59,10 @@ public function testToOptionArray()
7259
'',
7360
false
7461
);
75-
$pageCriteriaMock = $this->getMockForAbstractClass(
76-
'Magento\Framework\Api\SearchCriteriaInterface',
77-
[],
78-
'',
79-
false
80-
);
8162

82-
$this->pageRepositoryMock->expects($this->once())
83-
->method('getList')
84-
->with($pageCriteriaMock)
85-
->will($this->returnValue($pageCollectionMock));
86-
87-
$this->pageCriteriaFactoryMock->expects($this->once())
63+
$this->collectionFactory->expects($this->once())
8864
->method('create')
89-
->will($this->returnValue($pageCriteriaMock));
65+
->will($this->returnValue($pageCollectionMock));
9066

9167
$pageCollectionMock->expects($this->once())
9268
->method('toOptionIdArray')

0 commit comments

Comments
 (0)