/** * @param string $serverName * @param string $exceptionClass * @param string $message */ public function taskException($serverName, $exceptionClass, $message) { $formatter = Deployer::get()->getHelper('formatter'); $messages = explode("\n", $message); array_unshift($messages, "Exception [{$exceptionClass}] on [{$serverName}] server:"); $this->output->writeln($formatter->formatBlock($messages, 'error', true)); }
public function testOutputWatcher() { $output = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface'); $output->expects($this->any())->method('write'); $output->expects($this->once())->method('setVerbosity'); $output->expects($this->once())->method('getVerbosity')->will($this->returnValue(OutputInterface::VERBOSITY_NORMAL)); $output->expects($this->once())->method('setDecorated'); $output->expects($this->once())->method('isDecorated'); $output->expects($this->once())->method('setFormatter'); $output->expects($this->once())->method('getFormatter'); $ow = new OutputWatcher($output); $ow->write('test'); $this->assertTrue($ow->getWasWritten()); $ow->writeln('test'); $ow->setVerbosity(OutputInterface::VERBOSITY_NORMAL); $this->assertEquals(OutputInterface::VERBOSITY_NORMAL, $ow->getVerbosity()); $ow->setDecorated(true); $ow->isDecorated(); $ow->setFormatter($this->getMock('Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface')); $ow->getFormatter(); $ow->setWasWritten(false); $this->assertFalse($ow->getWasWritten()); }
/** * @param string $serverName * @param string $exceptionClass * @param string $message */ public function taskException($serverName, $exceptionClass, $message) { $message = " {$message} "; $this->output->writeln(["", "<error>Exception [{$exceptionClass}] on [{$serverName}] server</error>", "<error>" . str_repeat(' ', strlen($message)) . "</error>", "<error>{$message}</error>", "<error>" . str_repeat(' ', strlen($message)) . "</error>", ""]); }