Exemplo n.º 1
0
 /**
  * @param string $name
  * @param ApiManager $manager
  * @param integer $code
  * @param Exception $previous
  */
 public function __construct($name, ApiManager $manager, $code = null, Exception $previous = null)
 {
     $this->manager = $manager;
     $this->name = $name;
     $message = sprintf('No API defined with name "%s".', $name);
     $suggestions = $manager->getNames();
     if (!empty($suggestions)) {
         $imploded = implode('", "', $suggestions);
         $message .= sprintf(' Did you mean "%s"?', $imploded);
     }
     parent::__construct($message, $code, $previous);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $api = $this->manager->get($input->getOption(self::OPT_API));
     $api->load($this->loaders, $this->suite);
 }
Exemplo n.º 3
0
 public function testGetNames()
 {
     $api = Mockery::mock('PhpTest\\Api\\ApiInterface');
     $manager = new ApiManager(['foo' => $api]);
     $this->assertSame(['foo'], $manager->getNames());
 }