Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProxyGeneratorTest.php
Go to the documentation of this file.
1 <?php
8 
12 
13 class ProxyGeneratorTest extends \PHPUnit\Framework\TestCase
14 {
18  private $proxyScannerMock;
19 
23  private $configurationScannerMock;
24 
28  private $model;
29 
30  protected function setUp()
31  {
32  $this->proxyScannerMock = $this->getMockBuilder(\Magento\Setup\Module\Di\Code\Scanner\XmlScanner::class)
33  ->disableOriginalConstructor()
34  ->getMock();
35 
36  $this->configurationScannerMock = $this->getMockBuilder(
37  \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner::class
38  )->disableOriginalConstructor()
39  ->getMock();
40 
41  $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
42  $this->model = $objectManagerHelper->getObject(
43  \Magento\Setup\Module\Di\App\Task\Operation\ProxyGenerator::class,
44  [
45  'proxyScanner' => $this->proxyScannerMock,
46  'configurationScanner' => $this->configurationScannerMock,
47  ]
48  );
49  }
50 
51  public function testDoOperation()
52  {
53  $files = ['file1', 'file2'];
54  $this->configurationScannerMock->expects($this->once())
55  ->method('scan')
56  ->with('di.xml')
57  ->willReturn($files);
58  $this->proxyScannerMock->expects($this->once())
59  ->method('collectEntities')
60  ->with($files)
61  ->willReturn([]);
62 
63  $this->model->doOperation();
64  }
65 }
foreach($appDirs as $dir) $files