/** * @dataProvider outputVerbosityDataProvider */ public function testIsDebug($verbosity_level) { $this->output->getVerbosity()->willReturn($verbosity_level)->shouldBeCalled(); $actual = $this->io->isDebug(); if ($verbosity_level >= OutputInterface::VERBOSITY_DEBUG) { $this->assertTrue($actual, 'Output should be debug.'); } else { $this->assertFalse($actual, 'Output should not be debug.'); } }
/** * Runs the command. * * @param callable|null $callback Callback. * * @return string * @throws RepositoryCommandException When command execution failed. */ private function _doRun($callback = null) { $process = $this->_processFactory->createProcess($this->_commandLine, 1200); try { $start = microtime(true); $process->mustRun($callback); if ($this->_io->isVerbose()) { $runtime = sprintf('%01.2f', microtime(true) - $start); $this->_io->writeln(array('', '<debug>[svn, ' . round($runtime, 2) . 's]: ' . $this->_commandLine . '</debug>')); } $output = (string) $process->getOutput(); if ($this->_io->isDebug()) { $this->_io->writeln($output, OutputInterface::OUTPUT_RAW); } return $output; } catch (ProcessFailedException $e) { throw new RepositoryCommandException($this->_commandLine, $process->getErrorOutput()); } }
/** * Runs the command. * * @param callable|null $callback Callback. * * @return string * @throws RepositoryCommandException When command execution failed. */ private function _doRun($callback = null) { try { $start = microtime(true); $this->_process->mustRun($callback); if ($this->_io->isVerbose()) { $runtime = sprintf('%01.2f', microtime(true) - $start); $command_line = $this->_process->getCommandLine(); $this->_io->writeln(PHP_EOL . '<fg=white;bg=magenta>[svn, ' . round($runtime, 2) . 's]: ' . $command_line . '</>'); } } catch (ProcessFailedException $e) { $process = $e->getProcess(); throw new RepositoryCommandException($process->getCommandLine(), $process->getErrorOutput()); } $output = (string) $this->_process->getOutput(); if ($this->_io->isDebug()) { $this->_io->writeln($output, OutputInterface::OUTPUT_RAW); } return $output; }