Ejemplo n.º 1
0
 public function testIsObjectMethod()
 {
     $container = new Container();
     $container->set('now', new \DateTime('now'));
     $this->assertTrue($container->isObject('now'));
 }
Ejemplo n.º 2
0
 /**
  * @return $this
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     if (null === $input) {
         $this->input = new ArgvInput();
     }
     if (null === $output) {
         $this->output = new ConsoleOutput();
     }
     $className = $this->getCommandClassName($this->input);
     if (class_exists($className)) {
         $this->commandName = $this->getCommandName($this->input);
         $this->commandInstance = $className::create($this->commandName);
         $this->commandInstance->setApplication($this);
         $this->add($this->commandInstance);
     } else {
         $commandEvent = Event\Type\Dummy::create();
     }
     // Dispatch event
     $cliArgsContainer = new Container('cliArgsContainer');
     if ($this->input->hasParameterOption('--env')) {
         $cliArgsContainer->set('env', $this->input->getParameterOption('--env'));
     }
     $commandEvent = CommandEvent::create($this, $cliArgsContainer);
     $this->application->dispatch($commandEvent);
     // Run command
     if ($commandEvent->getStatus() != Event\STATUS_DISCARDED) {
         $this->doRun($this->input, $this->output);
     }
 }