echo in phpunit tests

I have been trying to echo stuff in my phpunit tests but no luck so far.

I read the documentation about the xml config file and apparently the debug parameter is what I am looking for. Unfortunately it still doesn’t work. Anyhow here is my xml config file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true"

Both processIsolation and verbose are accepted but debug is not.

The command actually works pretty fine when I directly pass it to phpunit like this:

phpunit --debug MyTest.php # here stuff is echoed correctly

but with the xml config file it looks like it is ignored.

PHPUnit skips all tests

When I attempt to run PHPUnit, all tests are skipped immediately – there is no error or anything. Can someone point me in the right direction? [vagrant@vagrant selenium]$ phpunit . PHPUnit 3.7.28 by S

examples of PHPunit tests

this is my first post, and i am looking for examples of phpunit tests which people use in regards to building a large laravel site. So far, i have writen these, which test if the site is working, but

Slow PHPUnit Tests

I am running PHPUnit to test a CodeIgniter application using CIUnit (a third party interface between the two). A number of the tests select data from an empty MySQL database that is populated with 5-1

Dependencies between PHPUnit tests

I’m writing a PHPUnit test case for an API (so not exactly a unit test) and I’m thinking about having a test that all other tests will depend on. The tests in the test case make API requests. Most of

PHPunit can’t find tests

PHPunit isn’t able to find my tests, but it does find my XML configuration. This is the config: <?xml version=1.0 encoding=UTF-8?> <phpunit backupGlobals=false backupStaticAttributes=f

Running PHPUnit tests Yii Framework

What possibilities are there to run unit tests with my Yii application? So far, I have been testing them this way: Open command prompt > cd C:/WHEREVER MY APP IS/protected/tests > phpunit unit/T

Running phpunit tests using HHVM (HipHop)

I am trying to run PHPUnit unit tests via HHVM on a virtual Ubuntu 12.04 (64-bit Server) install. The tests usually run using a phpunit.xml file located in my tests directory, which includes a bootstr

phpunit default tests directory (for travis integration)

I’ve got a github project which I want to integrate with travis. Currently I execute my tests with: phpunit tests command. I would like to make the tests execute with: phpunit since travis needs it.

How to skip tests in PHPunit?

I am using phpunit in connection with jenkins, and I want to skip certain tests by setting the configuration in the XML file phpunit.xml I know that I can use on the command line: phpunit –filter te

Organizing PHPUnit Tests in Namespaces

I see two options for organizing PHPUnit unit tests into a namespace hierarchy. What are the advantages/disadvantages to these two approaches? Are there any obvious flaws I haven’t considered that wou


Current versions of PHPUnit >3.6.4 (and all 3.5.* versions) will just print everything you echo in a test case.


class OutputTestCase extends PHPUnit_Framework_TestCase {

    public function testEcho() {
        echo "Hi";


phpunit foo.php 
PHPUnit 3.6.7 by Sebastian Bergmann.


Time: 0 seconds, Memory: 3.25Mb

OK (1 test, 0 assertions)

So if you are on an old 3.6 version just upgrade 🙂

Make sure you don’t call exit() or kill(). PHPUnit buffers the echo statements and that buffer will be lost with no output if your script exits during the test.

processIsolation is suppressing the output of tests so you have to disable it. The interaction with the debug flag was probably an oversight introduced with this: