Alex Rivera | Logout

What is wrong with control characters in PHPUnit command line tool?

Asked 2011-12-30T09:04:52.113
12

When I run phpunit from a command line, the control characters are being printed out instead of acting like control characters. Take look at this:

PHPUnit 3.6.5 by Sebastian Bergmann.

Configuration read from app\phpunit.xml.dist

...

Time: 1 second, Memory: 12.00Mb

‹[30;42m‹[2KOK (3 tests, 3 assertions)
‹[0m‹[2K

I assume that signs like ‹[30;42m< are some kind of control characters and should be used by console in different way (positioning the cursor, deleting characters etc.)

What can be wrong here?

Edit
Report

1 Answer

1

Thanx Danny, your answer was very helpful.

For users that want to implement this a few tips:

  1. put the code from Danny in a shell file (for example ~/.phpunit.sh)
  2. add an alias to phpunit in ~/.bashrc (just add the following line). If you don't have a .bashrc yet, just create an empty file.

    alias phpunit="~/.phpunit.sh"

  3. close your bash and open it again

  4. things should work now, but test it to be sure.
answered 2013-06-19T09:39:34.410

Your Answer