Code below shows a cut-down version of original XML_Util/tests/AllTests.php (1.2.1)
We will replace the highlihted yellow line as follow (lines 6-7) :
Now lets have a look on a more complex XML configuration file, that introduces PEAR::Log handler conf options (lines 8-12 and 17-22), and mask level message ability (lines 6-7,16).
During developpement of PEAR_TestListener_Configuration
, a wrapper for the PHPUnit XML configuration file,
between current version and future PHPUnit_Util_Configuration
available with PHPUnit 3.4.0, I would like
to add ability to configure all loggers (PEAR::Log handlers) as it could be with simple PEAR::Log API calls.
I like especially the feature to define easily a mask as it could be with PEAR::Log package. See Log Level Masks.
Of course you can combine level and mask definition, as it was done here (lines 6-7), even if both lines gave same result (it's an example).
To run all the tests that are declared in XML_Util_AllTests::suite()
we can use the following command:
php path/to/XML_Util/AllTests.php --configuration /path/to/phpunit.xml PHPUnit 3.3.16 by Sebastian Bergmann. .................. Time: 6 seconds OK (18 tests, 0 assertions)
You will find text file as defined in phpunit.xml
(line 5),
with a following cut-down version.
[2009-06-06 17:40:24] XML_Util_AllTests All Events: TestSuite 'XML_Util Full Suite of Unit Tests' started. [2009-06-06 17:40:24] XML_Util_AllTests All Events: TestSuite 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests' started. [2009-06-06 17:40:24] XML_Util_AllTests All Events: Test 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests\testBasic_apiVersion.phpt' started. [2009-06-06 17:40:25] XML_Util_AllTests All Events: Test 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests\testBasic_apiVersion.phpt' ended. ... more ... [2009-06-06 17:40:31] XML_Util_AllTests All Events: Test 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests\testBug_5392.phpt' started. [2009-06-06 17:40:31] XML_Util_AllTests All Events: Test 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests\testBug_5392.phpt' ended. [2009-06-06 17:40:31] XML_Util_AllTests All Events: TestSuite 'C:\wamp\bin\php\php5.2.9-2\tests\XML_Util\tests' ended. [2009-06-06 17:40:31] XML_Util_AllTests All Events: TestSuite 'XML_Util Full Suite of Unit Tests' ended.
And got an email named XML_Util AllTests results with this body
Jun 06 17:40:31 - TestSuite was successful. Tests: 18.
Because we have decided it like that. See line 25 that identify to use file definition from lines 4 to 13, and line 26 that identify to use mail definition from lines 14 to 23.
We can have multiple definitions, only those identified by the composite logger will be finally used.