[Console] Fix tests on windows

This commit is contained in:
Jordi Boggiano 2012-01-09 17:05:16 +01:00
parent cd77327e9a
commit bea7a9c865
3 changed files with 10 additions and 7 deletions

View File

@ -253,7 +253,7 @@ class Application
); );
} }
return implode("\n", $messages); return implode(PHP_EOL, $messages);
} }
/** /**
@ -649,7 +649,7 @@ class Application
} }
} }
return implode("\n", $messages); return implode(PHP_EOL, $messages);
} }
$messages = array($this->getHelp(), ''); $messages = array($this->getHelp(), '');
@ -764,11 +764,13 @@ class Application
$messages[] = str_repeat(' ', $len); $messages[] = str_repeat(' ', $len);
$output->writeln("\n"); $output->writeln("");
$output->writeln("");
foreach ($messages as $message) { foreach ($messages as $message) {
$output->writeln('<error>'.$message.'</error>'); $output->writeln('<error>'.$message.'</error>');
} }
$output->writeln("\n"); $output->writeln("");
$output->writeln("");
if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) { if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
$output->writeln('<comment>Exception trace:</comment>'); $output->writeln('<comment>Exception trace:</comment>');
@ -792,7 +794,8 @@ class Application
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line)); $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line));
} }
$output->writeln("\n"); $output->writeln("");
$output->writeln("");
} }
} while ($e = $e->getPrevious()); } while ($e = $e->getPrevious());

View File

@ -68,7 +68,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
public function testHelp() public function testHelp()
{ {
$application = new Application(); $application = new Application();
$this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', $application->getHelp(), '->setHelp() returns a help message'); $this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', str_replace(PHP_EOL, "\n", $application->getHelp()), '->setHelp() returns a help message');
} }
public function testAll() public function testAll()

View File

@ -33,6 +33,6 @@ help Displays help for a command
list Lists commands list Lists commands
EOF; EOF;
$this->assertEquals($output, $commandTester->getDisplay(), 'boo'); $this->assertEquals(str_replace("\n", PHP_EOL, $output), $commandTester->getDisplay(), 'boo');
} }
} }