/**
  * {@inheritdoc}
  */
 public function doOperation()
 {
     if (array_diff(array_keys($this->data), ['filePatterns', 'paths', 'excludePatterns']) !== array_diff(['filePatterns', 'paths', 'excludePatterns'], array_keys($this->data))) {
         return;
     }
     foreach ($this->data['paths'] as $paths) {
         if (!is_array($paths)) {
             $paths = (array) $paths;
         }
         $files = [];
         foreach ($paths as $path) {
             $this->classesScanner->getList($path);
             $files = array_merge_recursive($files, $this->directoryScanner->scan($path, $this->data['filePatterns'], $this->data['excludePatterns']));
         }
         $entities = $this->phpScanner->collectEntities($files['php']);
         foreach ($entities as $entityName) {
             class_exists($entityName);
         }
     }
 }
Пример #2
0
    public function testCollectEntities()
    {
        $this->_logMock->expects(
            $this->at(0)
        )->method(
            'add'
        )->with(
            4,
            'Magento\SomeModule\Module\Factory',
            'Invalid Factory for nonexistent class Magento\SomeModule\Module in file ' . $this->_testFiles[0]
        );
        $this->_logMock->expects(
            $this->at(1)
        )->method(
            'add'
        )->with(
            4,
            'Magento\SomeModule\Element\Factory',
            'Invalid Factory declaration for class Magento\SomeModule\Element in file ' . $this->_testFiles[0]
        );

        $this->assertEquals([], $this->_model->collectEntities($this->_testFiles));
    }