示例#1
0
 /**
  * @throws PrerequisiteFailedException
  */
 public function guardPrerequisites()
 {
     $undefinedTypes = array();
     foreach ($this->executionContext->getGeneratedTypes() as $type) {
         if (!class_exists($type) && !interface_exists($type)) {
             $undefinedTypes[] = $type;
         }
     }
     if ($undefinedTypes) {
         throw new PrerequisiteFailedException(sprintf("The type%s %s %s generated but could not be loaded. Do you need to configure an autoloader?\n", count($undefinedTypes) > 1 ? 's' : '', join(', ', $undefinedTypes), count($undefinedTypes) > 1 ? 'were' : 'was'));
     }
 }
 function it_throws_execption_when_types_do_not_exist(ExecutionContextInterface $executionContext)
 {
     $executionContext->getGeneratedTypes()->willReturn(array('stdClassXXX'));
     $this->shouldThrow('PhpSpec\\Process\\Prerequisites\\PrerequisiteFailedException')->duringGuardPrerequisites();
 }