Extension:MWUnit/Configuring MWUnit

MWUnit's default behaviour can be changed through several configuration parameters.

This configuration parameter defines the maximum execution time for all tests in a test run. It corresponds directly with the PHP function. This function limits the maximum execution time of a PHP script. The limit defined by this configuration parameter is therefore a hard limit and the script will die dramatically when this time limit is reached.

This configuration parameter defines whether or not to use TestDox as the default result printer when running MWUnit through the command-line test runner.

This configuration parameter defines whether or not to back up PHP superglobals before each test case and restore them after each test.

When this configuration parameter is set to true, MWUnit will clone all superglobals, with  as the only exception, and store these before running a test. After the test has completed, MWUnit will restore the superglobals to the superglobals it saved before the test.

This configuration parameter defines whether or not to be strict about untruthful  annotations. When this configuration parameter is set to, MWUnit will perform additional checks to make sure the template given in the   annotation is actually used in the test case. If the template in the test case is not used in the test, the test will be marked as risky.

These checks are performed by hooking into the ParserFetchTemplate hook and checking if that hook is ever fired during the test case with the template specified in the annotation. Since the MediaWiki parser caches template fetches, this hook is only ever called once per template. This would mean if we created a variable (through the Variables extension)in the fixture with that template, the hook would not get called in the test case. To remedy this, the initial parser before the first test case is cloned and stored. Before the test is run, we check if the template specified in the  annotation is in the initial parser's cache and presume it is used if it is. This may rarely lead to false negatives unfortunately.

Individual tests can be exempt from these checks by annotating them with.

This configuration parameters defines whether or not to force tests to have a  annotation. Tests without the  annotation will not be executed when this check is enabled.

This configuration parameter defines whether or not to allow users with the right  to actually run a test as a different user.

This configuration parameter defines whether or not to show profiling info on the result special page. If this parameter is set to true, profiling information, such as running time and memory usage will be shown on the special page. Profiling information will be collected regardless of the value of this parameter.

This configuration parameter defines whether or not to allow the transclusion of pages in the NS_TEST namespace.