Writing PHPUnit tests: Difference between revisions
From MoodleDocs
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
Moodle PHPUnit integration is designed to allow easy adding of new tests. At the start of each test the state is automatically reset to fresh new installation (unless explicitly told not to reset). Tests that need to modify default installation may use generators to create new courses, users, etc. | Moodle PHPUnit integration is designed to allow easy adding of new tests. At the start of each test the state is automatically reset to fresh new installation (unless explicitly told not to reset). Tests that need to modify default installation may use generators to create new courses, users, etc. | ||
=Long tests= | |||
All standard test should execute as fast as possible. Tests that take a loner time to execute (>10s) or are otherwise expensive (such as querying external servers that might be flooded by all dev machines) should be execute only when PHPUNIT_LONGTEST is true. This constant can be set in phpunit.xml or directly in config.php. | |||
=See also= | =See also= |
Revision as of 13:34, 15 May 2012
Moodle 2.3
Moodle PHPUnit integration is designed to allow easy adding of new tests. At the start of each test the state is automatically reset to fresh new installation (unless explicitly told not to reset). Tests that need to modify default installation may use generators to create new courses, users, etc.
Long tests
All standard test should execute as fast as possible. Tests that take a loner time to execute (>10s) or are otherwise expensive (such as querying external servers that might be flooded by all dev machines) should be execute only when PHPUNIT_LONGTEST is true. This constant can be set in phpunit.xml or directly in config.php.