예제 #1
0
 /**
  * @param ResourceInterface $resource
  * @return string
  */
 private function getFilePath(ResourceInterface $resource)
 {
     if ($this->generator->supports($resource, 'specification', array())) {
         return $resource->getSpecFilename();
     }
     return $resource->getSrcFilename();
 }
 function it_chooses_generator_by_priority(GeneratorInterface $generator1, GeneratorInterface $generator2, ResourceInterface $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'));
 }
 /**
  * {@inheritDoc}
  */
 public function getPriority()
 {
     return $this->delegate->getPriority();
 }