Repository navigation
Closed
Description
Hi,
it seems that using "printerFile" relative paths in phpunit.xml leads to some problems / restricts how tests can be executed.
This is part of the phpunit.xml we generate for the root of the project:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="lib/phpunit/phpunit.xsd"
bootstrap="lib/phpunit/bootstrap.php"
....
....
printerClass="Hint_ResultPrinter"
printerFile="lib/phpunit/classes/hint_resultprinter.php"
>
<testsuites>
....
....
And, this one example for the phpunit corresponding to one plugin/module (/mod/forum, 2 dirs deeper):
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/phpunit/phpunit.xsd"
bootstrap="../../lib/phpunit/bootstrap.php"
....
....
printerClass="Hint_ResultPrinter"
printerFile="../../lib/phpunit/classes/hint_resultprinter.php"
>
<testsuites>
....
....
Using those phpunit files we are able to run:
cd /path/to/rootdir && phpunit
cd /path/to/rootdir/mod/forum && phpunit
But any of these fail with error: "Could not use "Hint_ResultPrinter" as printer."
cd /path/to/rootdir && cd .. && phpunit -c rootdir
cd /path/to/rootdir && cd .. && phpunit -c rootdir/phpunit.xml
cd /path/to/rootdir && phpunit -c mod/forum
cd /path/to/rootdir && phpunit -c mod/forum/phpunit.xml
And they were working ok before introducing the custom ResultPrinter in phpunit.xml. Also note that we use the relative path for the bootstrap and is working perfectly, so it would be desirable to get also the printerFile supporting those relatives.
For reference:
- code-base: https://github.com/moodle/moodle
- original issue in Moodle tracker (fixed by temp removal of the printerFile from the generated phpunit.xml files: http://tracker.moodle.org/browse/MDL-33436
Ciao :-)
Metadata
Metadata
Assignees
Labels
No labels
Activity
edorian commentedon Jun 5, 2012
Thanks for the report. There have been a couple of issues with relative/absolute on other parts of the config.
To sum up and to see if i understood you right:
You'd assume the path to the file is realtive to the phpunit.xml location and not to the current working directory?
I agree on that. I need to look at the code to find a way to make that happen without any bc break. Maybe check both pathes or something.
Thanks for the report :)
stronk7 commentedon Jun 6, 2012
Yup, I think "relative to the phpunit.xml" is the goal. That enables them being invoked from anywhere.
Thanks!