Zend framework2 PHPunit Zend framework 2断言响应代码失败;302;,实际状态代码为";200“;

Zend framework2 PHPunit Zend framework 2断言响应代码失败;302;,实际状态代码为";200“;,zend-framework2,phpunit,Zend Framework2,Phpunit,我们尝试插入的数据是否在尝试单元测试时实际插入 $phpunit 塞巴斯蒂安·伯格曼的PHPUnit 3.7.21 从C:\xampp\htdocs\health360\module\Album\test\phpunit.xml读取配置 ←[41;37mF←[0m 时间:0秒,内存:8.75Mb 有1次失败: 1) AlbumTest\Controller\AlbumControllerTest::TestIndexAction可以访问 断言响应代码“302”失败,实际状态代码为“200” C:

我们尝试插入的数据是否在尝试单元测试时实际插入

$phpunit 塞巴斯蒂安·伯格曼的PHPUnit 3.7.21

从C:\xampp\htdocs\health360\module\Album\test\phpunit.xml读取配置

←[41;37mF←[0m

时间:0秒,内存:8.75Mb

有1次失败:

1) AlbumTest\Controller\AlbumControllerTest::TestIndexAction可以访问 断言响应代码“302”失败,实际状态代码为“200”

C:\xampp\htdocs\health360\vendor\zendframework\zendframework\library\Zend\Test\p HPUnit\Controller\AbstractControllerTestCase.php:418 C:\xampp\htdocs\health360\module\Album\test\AlbumTest\Controller\AlbumController Test.php:73

我遵循zend框架的官方文档


问题可能是什么

您是否也可以共享AlbumControllerTest类中的testIndexActionCanBeAccessed方法?您是否可以向我们展示indexActionController的代码;断言302?您的操作结束时是否有任何重定向?如果您正在学习ZF2教程,indexAction返回代码200,addAction,updateAction,deleteAction可在有效表单post后返回302