1

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 ?

MARTIN Damien
  • 996
  • 2
  • 15
  • 36
  • Whats your use case for this? Or to rephrase: Why are you doing this and are you shipping a version of phpunit with your cms then or are users expected to install phpunit for this to works or something? :) – edorian Mar 03 '12 at 22:53
  • In fact it is a personal project. I want it to be the pretiest project I ever done. So I want to use all I can to make it better. And the project is not made for redistribution but the source code will be open to be used as an exemple and a study case. (I wish to make a big tutorial at the end of the project). I don't have time constraints and I will certainly not exceed 20 users I suppose. – MARTIN Damien Mar 04 '12 at 11:58

1 Answers1

2

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 :)

MARTIN Damien
  • 996
  • 2
  • 15
  • 36
  • You can combine the last two lines into `$buffer = ob_get_clean();`. See [ob_get_clean](http://php.net/manual/en/function.ob-get-clean.php). – David Harkness Mar 03 '12 at 19:05