Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DocRootLocatorTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class DocRootLocatorTest extends \PHPUnit\Framework\TestCase
12 {
20  public function testIsPub($path, $isExist, $result)
21  {
22  $request = $this->createMock(\Magento\Framework\App\Request\Http::class);
23  $request->expects($this->once())->method('getServer')->willReturn($path);
24  $reader = $this->createMock(\Magento\Framework\Filesystem\Directory\Read::class);
25  $reader->expects($this->any())->method('isExist')->willReturn($isExist);
26  $readFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
27  $readFactory->expects($this->once())->method('create')->willReturn($reader);
28  $model = new DocRootLocator($request, $readFactory);
29  $this->assertSame($result, $model->isPub());
30  }
31 
35  public function isPubDataProvider()
36  {
37  return [
38  ['/some/path/to/root', false, false],
39  ['/some/path/to/root', true, false],
40  ['/some/path/to/pub', false, true],
41  ['/some/path/to/pub', true, false],
42  ];
43  }
44 }