Getting some HTML out of PHPUnit
Posted: Mon Sep 04, 2006 9:04 am
I've written this
And despite reading virtually everything in the almost entirely irrelevent, PHPUnit Pocket Guide I've still no idea how I actually run this test and get HTML output. Is there no HtmlReporter in PHPUnit?
This is what that code produces:
Code: Select all
require_once 'PHPUnit/Framework/TestCase.php';
class TestOfStuff extends PHPUnit_Framework_TestCase
{
public function testSucess()
{
$this->assertEqual(1 + 2, 3);
$this->assertTrue(true);
$this->assertFalse(false);
$this->assertNull(null);
}
public function testFailure()
{
$this->assertEqual(1 + 2, 4);
$this->assertTrue(false);
$this->assertFalse(true);
$this->assertNull(1);
}
public function testFail()
{
$this->fail('Doh!');
}
public function testPass()
{
$this->pass();
}
public function testSkip()
{
$this->markTestSkipped('Skippy');
}
public function testIncomplete()
{
$this->markTestIncomplete('Incompletely Convincing');
}
}
$test = new TestOfStuff();
$result = new PHPUnit_Framework_TestResult();
$test->run($result);This is what that code produces:
Code: Select all
Warning: Missing argument 2 for PHPUnit_Framework_Error::__construct(), called in /osis/lib/code/php/PHPUnit/Framework/TestCase.php on line 284 and defined in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 79
Warning: Missing argument 3 for PHPUnit_Framework_Error::__construct(), called in /osis/lib/code/php/PHPUnit/Framework/TestCase.php on line 284 and defined in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 79
Warning: Missing argument 4 for PHPUnit_Framework_Error::__construct(), called in /osis/lib/code/php/PHPUnit/Framework/TestCase.php on line 284 and defined in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 79
Warning: Missing argument 5 for PHPUnit_Framework_Error::__construct(), called in /osis/lib/code/php/PHPUnit/Framework/TestCase.php on line 284 and defined in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 79
Notice: Undefined variable: code in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 81
Notice: Undefined variable: file in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 83
Notice: Undefined variable: line in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 84
Notice: Undefined variable: trace in /osis/lib/code/php/PHPUnit/Framework/Error.php on line 85
