/** * Start the console application * * @return int 0 if everything went fine, or an error code */ public function run() { $this->configuration->apply($this->injector); $application = $this->injector->make(ConsoleApplication::class); array_map(function ($command) use($application) { $application->add($this->injector->make($command)); }, $this->commands->toArray()); return $application->run(); }
public function testRun() { $application = $this->getMockBuilder(ConsoleApplication::class)->setMethods(['run', 'add'])->getMock(); $application->expects($this->once())->method('run'); $application->expects($this->once())->method('add')->with(new Hello()); $this->configuration->expects($this->once())->method('apply')->with($this->injector); $this->injector->expects($this->exactly(2))->method('make')->will($this->onConsecutiveCalls($application, new Hello())); $this->commands->expects($this->any())->method('toArray')->willReturn([Hello::class]); Application::build($this->injector, $this->configuration, $this->commands)->run(); }
/** * Run the application * * @param string $runner * * @return \Psr\Http\Message\ResponseInterface */ public function run($runner = 'Relay\\Relay') { $this->configuration->apply($this->injector); return $this->injector->share($this->middleware)->prepare('Equip\\Directory', $this->routing)->execute($runner); }
/** * Run the application * * @param string $runner * * @return \Psr\Http\Message\ResponseInterface */ public function run($runner = Relay::class) { $this->configuration->apply($this->injector); return $this->injector->share($this->middleware)->prepare(Directory::class, $this->routing)->execute($runner); }
public function __construct(array $data = []) { $data = array_merge([EnvConfiguration::class, AurynConfiguration::class, AuraCliConfiguration::class, PredisConfiguration::class], $data); parent::__construct($data); }
/** * @expectedException Equip\Exception\ConfigurationException * @expectedExceptionRegExp /class .* must implement ConfigurationInterface/i */ public function testInvalidClass() { $set = new ConfigurationSet(); $set->withValue('\\stdClass'); }