Search code examples
content-management-systemphpunitezpublish

Run PHPUnit silently


I would like to know if it is possible to run PHPUnit tests silently and to show results manualy ?

Here is my file (this is the first time I use xUNIT tests) : https://github.com/martin-damien/sarkum/blob/b3951f6fd89b788d9abc51467a62271f32d12b8c/classes/Character.php

Am I doing it right ?

As I'm running this code inside a CMS I can't allow the tests to display something on screen out of my control...

Could someone help me please ?


Solution

  • I found something :

    ob_start();
    
    $result = PHPUnit_TextUI_TestRunner::run( $suite );
    
    $buffer = ob_get_contents();
    ob_end_clean();
    

    And I just have to send $buffer to my template :)