[UPHPU] PHPUnit Output Question

Justin Giboney jgiboney at gmail.com
Wed Mar 4 16:56:23 MST 2009


I am trying to learn PHPUnit and I can successfully create a unit test but I
don't know how to correctly output the code to a page. Here is what I have
for the code to output along with what it outputs. The problem with the
output, is that it is really hard to read. How can I  have some clean
output?
Thank you,

Justin Giboney

$suite = new PHPUnit_Framework_TestSuite('StringTest');
$result = $suite->run();
foreach ($result->failures() as $failure){
   echo '<hr>' . $failure->thrownException();
}


exception 'PHPUnit_Framework_ExpectationFailedException' with message
'Failed asserting that is true.' in
/usr/share/php/PHPUnit/Framework/Constraint.php:92 Stack trace: #0
/usr/share/php/PHPUnit/Framework/Assert.php(1484):
PHPUnit_Framework_Constraint->fail(false, '') #1
/usr/share/php/PHPUnit/Framework/Assert.php(668):
PHPUnit_Framework_Assert::assertThat(false,
Object(PHPUnit_Framework_Constraint_IsTrue), '') #2 /var/www/
www.knowledgeexams.com/htdocs/is201/index.php(34):
PHPUnit_Framework_Assert::assertTrue(false) #3 [internal function]:
StringTest->testToString() #4
/usr/share/php/PHPUnit/Framework/TestCase.php(489):
ReflectionMethod->invoke(Object(StringTest)) #5
/usr/share/php/PHPUnit/Framework/TestCase.php(404):
PHPUnit_Framework_TestCase->runTest() #6
/usr/share/php/PHPUnit/Framework/TestResult.php(609):
PHPUnit_Framework_TestCase->runBare() #7
/usr/share/php/PHPUnit/Framework/TestCase.php(375):
PHPUnit_Framework_TestResult->run(Object(StringTest)) #8
/usr/share/php/PHPUnit/Framework/TestSuite.php(677):
PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult)) #9
/usr/share/php/PHPUnit/Framework/TestSuite.php(658):
PHPUnit_Framework_TestSuite->runTest(Object(StringTest),
Object(PHPUnit_Framework_TestResult)) #10 /var/www/
www.knowledgeexams.com/htdocs/is201/index.php(56):
PHPUnit_Framework_TestSuite->run() #11 {main}


More information about the UPHPU mailing list