We have a Phing script that is used by Hudson to build / test our PHP site.
Some of our unit tests load a library of core functions; others use the layout to avoid having to do this (or provide specific fake test results).
Unit testing is performed perfectly when performed in isolation (ie, the command line, using phpunit ). However, when we run them together as a package in Phing, we get errors.
Errors in tests where we wrote mocks for certain functions. The error says that we declare the function twice. Obviously, he is trying to include a real function library as well as mocks.
Tests include code that is mutually exclusive, so they must be run in isolation from each other; It would seem that Phing runs them all in one process, therefore they are inclusive in conflict.
The relevant part of the phing script looks like this:
<phpunit haltonfailure="true" printsummary="true"> <batchtest> <fileset dir="${ws}/path/to/site/root/"> <include name="*Test.php" /> <include name="*/*Test.php" /> <include name="*/*/*Test.php" /> <include name="*/*/*/*Test.php" /> </fileset> </batchtest> <formatter type="xml" todir="${builddir}/logs" outfile="units.xml" /> </phpunit>
Is there a way to force phing to run tests independently, without specifying each separately in the build script?
source share