PHPUnit没有返回到下一个测试用例

时间:2010-11-12 19:00:53

标签: phpunit

我有两个测试用例,一个返回一个值,下一个是假设以使用返回值。

class GenerateAckFeedTest extends PHPUnit_Framework_TestCase
{
    public function testThankyouAckFeedErrors() 
    {
        $ackFeed = array(1,2,3);
        return $ackFeed;
    }

    /***
     * @depends testCitiThankyouAckFeedErrors
     */
    public function testCitiThankyouAckFeedGeneration(array $ackFeed)
    {

    }
}

我得到的错误是: 有1个错误:

1)testCitiThankyouAckFeedGeneration(GenerateAckFeedTest) 例外: ERRNO:4096 TEXT:传递给GenerateAckFeedTest :: testCitiThankyouAckFeedGeneration()的参数1必须是一个数组,没有给出 地点:/home/pvarney/host-server/www/active/unit_tests/GenerateAckFeedTest.php,第131行,2010年11月15日,上午10:55 显示回溯: GenerateAckFeedTest.testCitiThankyouAckFeedGeneration()#line 0,file:unknown ReflectionMethod.invoke(Object:GenerateAckFeedTest)#line 489,file:/usr/share/php/PHPUnit/Framework/TestCase.php PHPUnit_Framework_TestCase.runTest()#line 404,file:/usr/share/php/PHPUnit/Framework/TestCase.php PHPUnit_Framework_TestCase.runBare()#line 607,file:/usr/share/php/PHPUnit/Framework/TestResult.php PHPUnit_Framework_TestResult.run(Object:GenerateAckFeedTest)#line 375,file:/usr/share/php/PHPUnit/Framework/TestCase.php PHPUnit_Framework_TestCase.run(对象:PHPUnit_Framework_TestResult)#line 677,file:/usr/share/php/PHPUnit/Framework/TestSuite.php PHPUnit_Framework_TestSuite.runTest(Object:GenerateAckFeedTest,Object:PHPUnit_Framework_TestResult)#line 658,file:/usr/share/php/PHPUnit/Framework/TestSuite.php PHPUnit_Framework_TestSuite.run(对象:PHPUnit_Framework_TestResult,false,Array [0],Array [0])#line 324,file:/usr/share/php/PHPUnit/TextUI/TestRunner.php PHPUnit_TextUI_TestRunner.doRun(对象:PHPUnit_Framework_TestSuite,Array [4])#line 128,file:/usr/share/php/PHPUnit/TextUI/Command.php PHPUnit_TextUI_Command.main()#line 52,file:/ usr / bin / phpunit

我觉得我错过了一些相当明显的东西。

2 个答案:

答案 0 :(得分:6)

有两个问题,一个我认为是版本(我会接受Anti的回答,但这是一个评论),另一个是我在评论中使用的明星数量。

我有

/***
 *
 */

我需要

/**
 *
 */

答案 1 :(得分:2)

根据PHPUnit / Util / Test.php,getDependencies()方法签名测试依赖项在PHPUnit 3.4.0中实现。

你使用的是3.3.16 - 一个不支持此版本的旧版本。

相关问题