samedi 31 janvier 2015

assertEqual not works when testing equals of command output

Here is what I output in my command:



$output->writeln("\033[37;42m Translations from " . $input->getArgument('bundle') . " imported successfully! \033[0m");


Here is what I get in command line with trim func to delete spaces:



trim($commandTester->getDisplay())
..string(69) " Translations from AcmeDemoBundle imported successfully! "


But when I run this:



$this->assertEquals(" Translations from AcmeDemoBundle imported successfully! ", trim($commandTester->getDisplay()));


I get:



Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-' Translations from AcmeDemoBundle imported successfully! '
+Binary String: ...


What I am doing wrong?


Aucun commentaire:

Enregistrer un commentaire