Example #1
0
 public function ensureNoDevWarningOnSelfUpdate($command)
 {
     $application = new Application();
     $application->add(new SelfUpdateCommand());
     $inputMock = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface');
     $outputMock = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $inputMock->expects($this->once())->method('getFirstArgument')->will($this->returnValue($command));
     $outputMock->expects($this->never())->method("writeln");
     if (!defined('APP_DEV_WARNING_TIME')) {
         define('APP_DEV_WARNING_TIME', time() - 1);
     }
     $application->doRun($inputMock, $outputMock);
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!Application::isInstalledAsPhar()) {
         $output->writeln('<error>Self-update is available only for PHAR version.</error>');
         return 1;
     }
     $manager = new Manager(Manifest::loadFile(Application::MANIFEST_FILE));
     if ($manager->update($this->getApplication()->getVersion(), true)) {
         $output->writeln(sprintf('<info>Application was successfully updated</info>'));
     } else {
         $output->writeln(sprintf('<error>Updating failed or you already have latest version</error>'));
     }
 }