Esempio n. 1
0
 /**
  * adds some files to check for modifications
  * if these files are changed the cache must be invalidated
  */
 private function addDependingResources()
 {
     foreach (static::$dependingClasses as $class) {
         $reflection = new \ReflectionClass($class);
         $this->resources->add(new FileResource($reflection->getFileName()));
     }
 }
Esempio n. 2
0
 /**
  * @param \G\Yaml2Pimple\Loader\YamlFileLoader $loader
  * @param \G\Yaml2Pimple\ResourceCollection $resources
  * @param \G\Yaml2Pimple\FileCache $cache
  */
 public function it_adds_cache_depending_classes_to_resources($loader, $resources, $cache)
 {
     $this->setCache($cache);
     $cache->contains(Argument::any())->shouldBeCalled()->willReturn(false);
     $cache->setResources(Argument::any())->shouldBeCalled();
     $cache->save(Argument::type('string'), Argument::type('array'))->shouldBeCalled();
     $dependingClasses = array('\\G\\Yaml2Pimple\\Loader\\CacheLoader', '\\G\\Yaml2Pimple\\Parameter', '\\G\\Yaml2Pimple\\Definition');
     foreach ($dependingClasses as $class) {
         $refl = new \ReflectionClass($class);
         $testResource = new FileResource($refl->getFileName());
         $resources->add($testResource)->shouldBeCalled();
     }
     $resources->all()->shouldBeCalled();
     $resources->clear()->shouldBeCalled();
     $data = array();
     $loader->load(Argument::type('string'))->willReturn($data);
     $this->load('test.yaml')->shouldReturn($data);
 }