Functional test coverage is not recording any controllers being called by a Goutte web crawler.
<?php
use Goutte\Client;
class DummyTest extends PHPUnit_Framework_TestCase {
/**
* Web Crawler
* @var \Goutte\Client
*/
protected $client;
public function setUp() {
parent::setUp();
$this->client = new Client();
}
public function testActionIndex() {
$call = yii::app()->params['siteUrl'] . 'site/index';
$crawler = $this->client->request('POST', $call, array(), array(), array());
$response = $this->client->getResponse()->getContent();
$this->assertEquals(200, $this->client->getResponse()->getStatus());
}
//..
Instead the coverage report shows that the test itself has been covered. I was expecting the report to show the index action in the site controller to be also covered.
The test works and ascertaining that the server response is a 200 OK. Do I need to adjust any configuration to allow phpunit to follow the request into the controller/action? - Im Using the PHP yii framework and testing with netbeans and jenkins
The code coverage cannot be computed in this case, because you are crawling yor website. The debugger sees that the only code being executed is the test itself, PHPUnit and some Goutte code. Your controller is not being executed by the same process that runs phpunit. It's being executed by the web server, but PHPUnit can't notice it.