sebastianbergmann/phpunit — Issue #466: "Undefined offset: 0 in /usr/local/zend/share/pear/PHPUnit/Util/Configuration.php on line 860"
Author: bskendig
Created: 2012-01-23 18:03:55+00:00
State: open

My configuration XML file contains this:

src/tests/application/controllers/AuthenticationControllerTest.php

Previous versions of PHPUnit (through 3.6.7) worked fine, but this morning I upgraded to PHPUnit 3.6.8, and when I run it with my configuration file, it fails:

Call Stack:
0.0004 322840 1. {main}() /usr/local/zend/bin/phpunit:0
0.0056 695048 2. PHPUnit_TextUI_Command::main() /usr/local/zend/bin/phpunit:46
0.0057 695384 3. PHPUnit_TextUI_Command->run() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:125
0.0057 695384 4. PHPUnit_TextUI_Command->handleArguments() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:134
0.0536 3176768 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:666
0.0537 3177312 6. PHPUnit_Util_Configuration->getTestSuite() /usr/local/zend/share/pear/PHPUnit/Util/Configuration.php:768

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Argument #1 of PHPUnit_Framework_TestSuite::addTestFile() must be a string' in /usr/local/zend/share/pear/PHPUnit/Util/InvalidArgumentHelper.php on line 69

InvalidArgumentException: Argument #1 of PHPUnit_Framework_TestSuite::addTestFile() must be a string in /usr/local/zend/share/pear/PHPUnit/Util/InvalidArgumentHelper.php on line 69

Call Stack:
0.0004 322840 1. {main}() /usr/local/zend/bin/phpunit:0
0.0056 695048 2. PHPUnit_TextUI_Command::main() /usr/local/zend/bin/phpunit:46
0.0057 695384 3. PHPUnit_TextUI_Command->run() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:125
0.0057 695384 4. PHPUnit_TextUI_Command->handleArguments() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:134
0.0536 3176768 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:666
0.0537 3177312 6. PHPUnit_Util_Configuration->getTestSuite() /usr/local/zend/share/pear/PHPUnit/Util/Configuration.php:768
0.1290 3375148 7. PHPUnit_Framework_TestSuite->addTestFile() /usr/local/zend/share/pear/PHPUnit/Util/Configuration.php:878

The problem is line 859 of Configuration.php, which changes "getFilesAsArray($file)" to "getFilesAsArray($this->toAbsolutePath($file))". For my file, $this->toAbsolutePath($file) returns:

/path/to/my/project/main/src/tests/src/tests/application/controllers/AuthenticationControllerTest.php

"src/tests/" is duplicated in the path, which makes the path incorrect.