Example #1
0
 /**
  * {@inheritdoc}
  */
 public function doOperation()
 {
     if (empty($this->data)) {
         return;
     }
     $definitionsCollection = new DefinitionsCollection();
     foreach ($this->data as $path) {
         $definitionsCollection->addCollection($this->getDefinitionsCollection($path));
     }
     $areaCodes = array_merge([App\Area::AREA_GLOBAL], $this->areaList->getCodes());
     foreach ($areaCodes as $areaCode) {
         $this->configWriter->write($areaCode, $this->configReader->generateCachePerScope($definitionsCollection, $areaCode));
     }
 }
Example #2
0
 public function testGenerateCachePerScopeGlobal()
 {
     $definitionCollection = $this->getDefinitionsCollection();
     $this->diContainerConfig->expects($this->any())->method('getVirtualTypes')->willReturn($this->getVirtualTypes());
     $this->diContainerConfig->expects($this->any())->method('getPreferences')->willReturn($this->getPreferences());
     $getResolvedConstructorArgumentsMap = $this->getResolvedVirtualConstructorArgumentsMap($definitionCollection, $this->getVirtualTypes());
     $this->diContainerConfig->expects($this->any())->method('getInstanceType')->willReturnMap($this->getInstanceTypeMap($this->getVirtualTypes()));
     $this->diContainerConfig->expects($this->any())->method('getPreference')->willReturnMap($this->getPreferencesMap());
     $isConcreteMap = [];
     foreach ($definitionCollection->getInstancesNamesList() as $instanceType) {
         $isConcreteMap[] = [$instanceType, strpos($instanceType, 'Interface') === false];
         $getResolvedConstructorArgumentsMap[] = [$instanceType, $definitionCollection->getInstanceArguments($instanceType), $this->getResolvedArguments($definitionCollection->getInstanceArguments($instanceType))];
     }
     $this->typeReader->expects($this->any())->method('isConcrete')->willReturnMap($isConcreteMap);
     $this->argumentsResolver->expects($this->any())->method('getResolvedConstructorArguments')->willReturnMap($getResolvedConstructorArgumentsMap);
     $this->assertEquals($this->getExpectedGlobalConfig(), $this->model->generateCachePerScope($definitionCollection, Area::AREA_GLOBAL));
 }