[Phpwm] 'remote' code coverage (phpunit/xdebug etc) ?
David Goodwin
david at codepoets.co.uk
Wed Feb 22 12:20:15 UTC 2012
Hi,
For whatever reason I have some unit tests which are a bit like the following - they're there to ensure a JSON API works as expected.
class BlahblahTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->http_client = new Zend_Http_Client();
// etc.
}
public function testSomeRandomParametersGoingIn() {
$params = array('a' => 5, 'b' => 10, 'postcode' => 'b610dr');
$this->http_client->setParameterGet($params);
$this->http_client->setUri('http://some.where/blah/something.php');
$response = $this->http_client->request();
$json = $response->getBody();
$this->assertEquals(sizeof($json['errors']), 0, "should be no errors etc");
// and other assertions on the json response.
}
}
Where the some.where/blah/something.php exists within the current project / code base.
Has anyone come across any way of getting code coverage reports when I'm calling a URL? I.e. So I have some reports on code coverage within something.php.
I know it's possible with the Selenium PHPUnit extension, but I can't seem to find anything showing how it can/could be done using something like Zend_Http_Client rather than Selenium RC spawning a Firefox window and so on.
Thanks,
David.
More information about the Phpwm
mailing list