Exemplo n.º 1
0
 public function testAddCollection()
 {
     $this->model->addDefinition(self::INSTANCE_1, $this->getArgument());
     $this->collectionMock->expects($this->any())->method('getCollection')->willReturn([self::INSTANCE_2 => $this->getArgument()]);
     $this->model->addCollection($this->collectionMock);
     $this->assertEquals([self::INSTANCE_1 => $this->getArgument(), self::INSTANCE_2 => $this->getArgument()], $this->model->getCollection());
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function doOperation()
 {
     if (empty($this->data)) {
         return;
     }
     $definitionsCollection = new DefinitionsCollection();
     foreach ($this->data as $paths) {
         if (!is_array($paths)) {
             $paths = (array) $paths;
         }
         foreach ($paths as $path) {
             $definitionsCollection->addCollection($this->getDefinitionsCollection($path));
         }
     }
     $areaCodes = array_merge([App\Area::AREA_GLOBAL], $this->areaList->getCodes());
     foreach ($areaCodes as $areaCode) {
         $config = $this->configReader->generateCachePerScope($definitionsCollection, $areaCode);
         $config = $this->modificationChain->modify($config);
         $this->configWriter->write($areaCode, $config);
     }
 }