Zend framework Zend_Test_PHPUnit如何打印异常/输出?
如何在测试用例中回显来自控制器操作的html/xml输出 下面是我的测试用例:Zend framework Zend_Test_PHPUnit如何打印异常/输出?,zend-framework,phpunit,Zend Framework,Phpunit,如何在测试用例中回显来自控制器操作的html/xml输出 下面是我的测试用例: public function testCreateAccountIsASuccessfulRequest() { $this->dispatch('/v2/user/create-account'); $this->assertFalse($this->response->isException()); $this->assertNotRedirect();
public function testCreateAccountIsASuccessfulRequest()
{
$this->dispatch('/v2/user/create-account');
$this->assertFalse($this->response->isException());
$this->assertNotRedirect();
}
它在命令行中打印此命令:
test# /usr/local/bin/phpunit --verbose Controllers_UserControllerTest.php
PHPUnit 3.6.10 by Sebastian Bergmann.
F
Time: 0 seconds, Memory: 12.50Mb
There was 1 failure:
1) Controllers_UserControllerTest::testCreateAccountIsASuccessfulRequest
Failed asserting that true is false.
/path/to/tests/Controllers/UserControllerTest.php:17
/usr/local/bin/phpunit:46
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
test#
我不确定实际的例外情况是什么。怎么看?另外,如何查看控制器操作的实际输出?那么它发送到浏览器的HTML/XML呢?天哪,我今天很慢:
public function testCreateAccountIsASuccessfulRequest()
{
$this->dispatch('/v2/user/create-account');
echo $this->getResponse()->getBody();
$this->assertFalse($this->response->isException());
$this->assertNotRedirect();
}