public function testScan()
 {
     $phpFiles = ['one/file/php', 'two/file/php'];
     $configFiles = ['one/file/config', 'two/file/config'];
     $files = ['php' => $phpFiles, 'config' => $configFiles];
     $scannerPhp = $this->getMock('Magento\\Tools\\Di\\Code\\Scanner\\ScannerInterface');
     $scannerXml = $this->getMock('Magento\\Tools\\Di\\Code\\Scanner\\ScannerInterface');
     $scannerPhpExpected = ['Model_OneProxy', 'Model_TwoFactory'];
     $scannerXmlExpected = ['Model_OneProxy', 'Model_ThreeFactory'];
     $scannerPhp->expects($this->once())->method('collectEntities')->with($phpFiles)->will($this->returnValue($scannerPhpExpected));
     $scannerXml->expects($this->once())->method('collectEntities')->with($configFiles)->will($this->returnValue($scannerXmlExpected));
     $this->_model->addChild($scannerPhp, 'php');
     $this->_model->addChild($scannerXml, 'config');
     $actual = $this->_model->collectEntities($files);
     $expected = [$scannerPhpExpected, $scannerXmlExpected];
     $this->assertEquals($expected, array_values($actual));
 }
Example #2
0
                 //no log
                 break;
         }
     }
 }
 //2.1.2 Compile relations for Proxy/Interceptor classes
 $directoryInstancesNamesList->getList($generationDir);
 $relations = $directoryInstancesNamesList->getRelations();
 // 2.2 Compression
 if (!file_exists(dirname($relationsFile))) {
     mkdir(dirname($relationsFile), 0777, true);
 }
 $relations = array_filter($relations);
 file_put_contents($relationsFile, $serializer->serialize($relations));
 // 3. Plugin Definition Compilation
 $pluginScanner = new Scanner\CompositeScanner();
 $pluginScanner->addChild(new Scanner\PluginScanner(), 'di');
 $pluginDefinitions = [];
 $pluginList = $pluginScanner->collectEntities($files);
 $pluginDefinitionList = new \Magento\Framework\Interception\Definition\Runtime();
 foreach ($pluginList as $type => $entityList) {
     foreach ($entityList as $entity) {
         $pluginDefinitions[ltrim($entity, '\\')] = $pluginDefinitionList->getMethodList($entity);
     }
 }
 $output = $serializer->serialize($pluginDefinitions);
 if (!file_exists(dirname($pluginDefFile))) {
     mkdir(dirname($pluginDefFile), 0777, true);
 }
 file_put_contents($pluginDefFile, $output);
 //Reporter