Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DocumentRootTest.php
Go to the documentation of this file.
1 <?php
7 
14 
18 class DocumentRootTest extends \PHPUnit\Framework\TestCase
19 {
23  private $configMock;
24 
28  private $documentRoot;
29 
30  public function setUp()
31  {
32  $this->configMock = $this->getMockBuilder(DeploymentConfig::class)
33  ->disableOriginalConstructor()
34  ->getMock();
35 
36  $this->documentRoot = new DocumentRoot($this->configMock);
37  }
38 
42  public function testGetPath()
43  {
44  $this->configMockSetForDocumentRootIsPub();
45 
46  $this->assertSame(DirectoryList::PUB, $this->documentRoot->getPath());
47  }
48 
53  public function testIsPub()
54  {
55  $this->configMockSetForDocumentRootIsPub();
56 
57  $this->assertSame(true, $this->documentRoot->isPub());
58  }
59 
60  private function configMockSetForDocumentRootIsPub()
61  {
62  $this->configMock->expects($this->any())
63  ->method('get')
64  ->willReturnMap([
65  [
67  null,
68  true
69  ],
70  ]);
71  }
72 }