Exemplo n.º 1
0
 /**
  * @dataProvider getInterceptionConfigurationDataProvider
  */
 public function testGetInterceptionConfiguration($plugins)
 {
     $definedClasses = ['Class1'];
     $this->interceptionConfig->expects($this->once())->method('hasPlugins')->with('Class1')->willReturn(true);
     $this->typeReader->expects($this->any())->method('isConcrete')->willReturnMap([['Class1', true], ['instance', true]]);
     $this->pluginList->expects($this->once())->method('setInterceptedClasses')->with($definedClasses);
     $this->pluginList->expects($this->once())->method('setScopePriorityScheme')->with(['global', 'areaCode']);
     $this->pluginList->expects($this->once())->method('getPluginsConfig')->willReturn(['instance' => $plugins]);
     $this->model->addAreaCode('areaCode');
     $this->model->getInterceptionConfiguration($definedClasses);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function doOperation()
 {
     if (empty($this->data)) {
         return;
     }
     $this->interceptionConfigurationBuilder->addAreaCode(App\Area::AREA_GLOBAL);
     foreach ($this->areaList->getCodes() as $areaCode) {
         $this->interceptionConfigurationBuilder->addAreaCode($areaCode);
     }
     $generatorIo = new \Magento\Framework\Code\Generator\Io(new \Magento\Framework\Filesystem\Driver\File(), $this->data);
     $generator = new \Magento\Tools\Di\Code\Generator($generatorIo, [Interceptor::ENTITY_TYPE => 'Magento\\Tools\\Di\\Code\\Generator\\Interceptor']);
     $configuration = $this->interceptionConfigurationBuilder->getInterceptionConfiguration(get_declared_classes());
     $generator->generateList($configuration);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function doOperation()
 {
     if (empty($this->data)) {
         return;
     }
     $this->interceptionConfigurationBuilder->addAreaCode(App\Area::AREA_GLOBAL);
     foreach ($this->areaList->getCodes() as $areaCode) {
         $this->interceptionConfigurationBuilder->addAreaCode($areaCode);
     }
     $classesList = [];
     foreach ($this->data['intercepted_paths'] as $path) {
         $classesList = array_merge($classesList, $this->classesScanner->getList($path));
     }
     $generatorIo = new \Magento\Framework\Code\Generator\Io(new \Magento\Framework\Filesystem\Driver\File(), $this->data['path_to_store']);
     $generator = $this->generatorFactory->create(['ioObject' => $generatorIo, 'generatedEntities' => [Interceptor::ENTITY_TYPE => 'Magento\\Tools\\Di\\Code\\Generator\\Interceptor']]);
     $configuration = $this->interceptionConfigurationBuilder->getInterceptionConfiguration($classesList);
     $generator->generateList($configuration);
 }