【发布时间】:2014-07-12 11:54:39
【问题描述】:
功能测试覆盖率未记录 Goutte 网络爬虫调用的任何控制器。
<?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());
}
//..
覆盖率报告显示测试本身已被覆盖。 我期待报告显示站点控制器中的索引操作也将被涵盖。
测试有效,并确定服务器响应为 200 OK。 我是否需要调整任何配置以允许 phpunit 跟随请求进入控制器/动作? - 我使用 PHP yii 框架并使用 netbeans 和 jenkins 进行测试
【问题讨论】:
标签: yii jenkins phpunit functional-testing goutte