/**
  * @param Resource $resource
  * @return string
  */
 private function getFilePath(Resource $resource)
 {
     if ($this->generator->supports($resource, 'specification', array())) {
         return $resource->getSpecFilename();
     }
     return $resource->getSrcFilename();
 }
Esempio n. 2
0
 function it_chooses_generator_by_priority(Generator $generator1, Generator $generator2, Resource $resource)
 {
     $generator1->supports($resource, 'class', array('class' => 'CustomLoader'))->willReturn(true);
     $generator1->getPriority()->willReturn(0);
     $generator2->supports($resource, 'class', array('class' => 'CustomLoader'))->willReturn(true);
     $generator2->getPriority()->willReturn(2);
     $generator1->generate($resource, array('class' => 'CustomLoader'))->shouldNotBeCalled();
     $generator2->generate($resource, array('class' => 'CustomLoader'))->shouldBeCalled();
     $this->registerGenerator($generator1);
     $this->registerGenerator($generator2);
     $this->generate($resource, 'class', array('class' => 'CustomLoader'));
 }