Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PopulatorTest.php
Go to the documentation of this file.
1 <?php
7 
8 use \Magento\Framework\Autoload\Populator;
9 
11 
12 class PopulatorTest extends \PHPUnit\Framework\TestCase
13 {
15  protected $mockDirectoryList;
16 
17  protected function setUp()
18  {
19  $this->mockDirectoryList = $this->getMockBuilder(\Magento\Framework\App\Filesystem\DirectoryList::class)
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $this->mockDirectoryList->expects($this->any())
24  ->method('getPath')
25  ->willReturnArgument(0);
26  }
27 
28  public function testPopulateMappings()
29  {
30  $mockAutoloader = $this->getMockBuilder(\Magento\Framework\Autoload\AutoloaderInterface::class)
31  ->disableOriginalConstructor()
32  ->getMock();
33 
34  $mockAutoloader->expects($this->once())
35  ->method('addPsr4')
36  ->with(
37  'Magento\\',
38  [DirectoryList::GENERATED_CODE . '/Magento/'],
39  true
40  );
41  $mockAutoloader->expects($this->once())
42  ->method('addPsr0')
43  ->with('', [DirectoryList::GENERATED_CODE]);
44 
45  Populator::populateMappings($mockAutoloader, $this->mockDirectoryList);
46  }
47 }
static populateMappings(AutoloaderInterface $autoloader, DirectoryList $dirList)
Definition: Populator.php:22