Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetUtilityPageIdentifiersTest.php
Go to the documentation of this file.
1 <?php
8 
13 use PHPUnit\Framework\TestCase;
14 
18 class GetUtilityPageIdentifiersTest extends TestCase
19 {
25  private $model;
26 
30  private $scopeConfig;
31 
35  protected function setUp()
36  {
37  $objectManager = new ObjectManager($this);
38  $this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class)
39  ->setMethods(['getValue'])
40  ->disableOriginalConstructor()
41  ->getMockForAbstractClass();
42  $this->model = $objectManager->getObject(
43  GetUtilityPageIdentifiers::class,
44  [
45  'scopeConfig' => $this->scopeConfig,
46  ]
47  );
48  }
49 
55  public function testExecute()
56  {
57  $cmsHomePage = 'testCmsHomePage';
58  $cmsNoRoute = 'testCmsNoRoute';
59  $cmsNoCookies = 'testCmsNoCookies';
60  $this->scopeConfig->expects($this->exactly(3))
61  ->method('getValue')
62  ->withConsecutive(
63  [$this->identicalTo('web/default/cms_home_page'), $this->identicalTo(ScopeInterface::SCOPE_STORE)],
64  [$this->identicalTo('web/default/cms_no_route'), $this->identicalTo(ScopeInterface::SCOPE_STORE)],
65  [$this->identicalTo('web/default/cms_no_cookies'), $this->identicalTo(ScopeInterface::SCOPE_STORE)]
66  )->willReturnOnConsecutiveCalls(
67  $cmsHomePage,
68  $cmsNoRoute,
69  $cmsNoCookies
70  );
71  $this->assertSame([$cmsHomePage, $cmsNoRoute, $cmsNoCookies], $this->model->execute());
72  }
73 }
$objectManager
Definition: bootstrap.php:17