1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Cms\Test\Unit\Model\Page\Source;
- use Magento\Cms\Model\Page;
- use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
- class IsActiveTest extends \PHPUnit\Framework\TestCase
- {
- /**
- * @var Page|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $cmsPageMock;
- /**
- * @var ObjectManager
- */
- protected $objectManagerHelper;
- /**
- * @var Page\Source\IsActive
- */
- protected $object;
- /**
- * {@inheritdoc}
- */
- protected function setUp()
- {
- $this->objectManagerHelper = new ObjectManager($this);
- $this->cmsPageMock = $this->getMockBuilder(\Magento\Cms\Model\Page::class)
- ->disableOriginalConstructor()
- ->setMethods(['getAvailableStatuses'])
- ->getMock();
- $this->object = $this->objectManagerHelper->getObject($this->getSourceClassName(), [
- 'cmsPage' => $this->cmsPageMock,
- ]);
- }
- /**
- * @return string
- */
- protected function getSourceClassName()
- {
- return \Magento\Cms\Model\Page\Source\IsActive::class;
- }
- /**
- * @param array $availableStatuses
- * @param array $expected
- * @return void
- * @dataProvider getAvailableStatusesDataProvider
- */
- public function testToOptionArray(array $availableStatuses, array $expected)
- {
- $this->cmsPageMock->expects($this->once())
- ->method('getAvailableStatuses')
- ->willReturn($availableStatuses);
- $this->assertSame($expected, $this->object->toOptionArray());
- }
- /**
- * @return array
- */
- public function getAvailableStatusesDataProvider()
- {
- return [
- [
- [],
- [],
- ],
- [
- ['testStatus' => 'testValue'],
- [['label' => 'testValue', 'value' => 'testStatus']],
- ],
- ];
- }
- }
|