/**
  * @test
  * @expectedException        \GearHub\Tactician\Exceptions\MarshalException
  * @expectedExceptionMessage Unable to map parameter [data] to command [GearHub\Tactician\Tests\Stubs\TestCommand]
  */
 public function it_should_return_debugging_info()
 {
     $reflection = new ReflectionClass(TestCommand::class);
     $parameters = $reflection->getConstructor()->getParameters();
     MarshalException::whileMapping(TestCommand::class, $parameters[0]);
 }
Пример #2
0
 /**
  * Get a parameter value for a marshaled command.
  *
  * @param  string              $command
  * @param  ArrayAccess         $source
  * @param  ReflectionParameter $parameter
  * @param  array               $extras
  *
  * @return mixed
  */
 protected function getParameterValueForCommand($command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = [])
 {
     if (array_key_exists($parameter->name, $extras)) {
         return $extras[$parameter->name];
     }
     if (isset($source[$parameter->name])) {
         return $source[$parameter->name];
     }
     if ($parameter->isDefaultValueAvailable()) {
         return $parameter->getDefaultValue();
     }
     MarshalException::whileMapping($command, $parameter);
 }