3
votes

I have two test cases, one returns a value, the next is supposed to use the return value.

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

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

    }
}

The error I get is: There was 1 error:

1) testCitiThankyouAckFeedGeneration(GenerateAckFeedTest) Exception: ERRNO: 4096 TEXT: Argument 1 passed to GenerateAckFeedTest::testCitiThankyouAckFeedGeneration() must be an array, none given LOCATION: /home/pvarney/host-server/www/active/unit_tests/GenerateAckFeedTest.php, line 131, at November 15, 2010, 10:55 am Showing backtrace: 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(Object: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(Object:PHPUnit_Framework_TestResult, false, Array[0], Array[0]) # line 324, file: /usr/share/php/PHPUnit/TextUI/TestRunner.php PHPUnit_TextUI_TestRunner.doRun(Object: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

I feel like I'm missing something fairly obvious.

2
What PHPUnit version are you using? - Anti Veeranna
Can you provide a running example ? Maybe that will spawn some answers - edorian
I'm using phpunit 3.3.16. (Sorry for the late response, weekend came). I'll edit my example for a running example. Thanks a million, btw. - Parris Varney

2 Answers

6
votes

There were two issues, one I believe was the version (I would have accepted Anti's answer, but it was a comment), the other was the number of stars I was using in the comment.

I had

/***
 *
 */

I needed

/**
 *
 */
2
votes

According to PHPUnit/Util/Test.php getDependencies() method signature test dependencies were implemented in PHPUnit 3.4.0.

You were using 3.3.16 - an older version which does not support this.