zbdluw
Last Updated: February 25, 2016
·
1.337K
· tomas2387
40276387b66caf2bbf4e1b764da1b807

NewLines on PHPUnit tests

In my team we were having some problems on the display of some tests.
Some of them were outputting newlines and we were not able to redirect the output and show a clean phpunit test output.

The tests execution was like this:

Picture

It was very disturbing, that everytime we execute our tests that newline was there to annoy us.

So after a little research I found out that there was an interface in our application that was closed with a ?> (php close tag) and after that some new lines.

Picture

That was causing our tests to be output in a wrong way, so I just delete that tag and everything was fine again. :)

Say Thanks
Respond

2 Responses
Add your response

7487
1780640 10200579019476925 399806266 n

And this is the reason you shouldn't use the php close tag.

over 1 year ago ·
7490
Ffebdf905fae3278a260ed03c9d165c7

Using the php close tag is not the issue, having extra new lines at the end was. These can be automatically checked using tools such as phpcodesniffer or li3quality.

All projects should have enforced coding standards.

over 1 year ago ·