with fakes that are fully under control of the test Stubs ◦ Replaces all methods with stubs ◦ You configure return values of any methods Mocks ◦ Verify the behavior of interactions between unit and other objects ◦ Beware of coupling test to implementation
--filter <pattern> Filter which tests to run. --group ... Only runs tests from the specified group(s). --exclude-group ... Exclude tests from the specified group(s). --list-groups List available test groups. --repeat <times> Runs the test(s) repeatedly. --colors Use colors in output. --stderr Write to STDERR instead of STDOUT. --stop-on-error Stop execution upon first error. --stop-on-failure Stop execution upon first error or failure. --stop-on-skipped Stop execution upon first skipped test. --stop-on-incomplete Stop execution upon first incomplete test. --strict Run tests in strict mode. -v|--verbose Output more verbose information. --debug Display debbuging information during test execution. --process-isolation Run each test in a separate PHP process. --bootstrap <file> A "bootstrap" PHP file that is run before the tests. -c|--configuration <file> Read configuration from XML file. --no-configuration Ignore default configuration file (phpunit.xml). --include-path <path(s)> Prepend PHP's include_path with given path(s). -d key[=value] Sets a php.ini value. -h|--help Prints this usage information. --version Prints the version and exits. --debug Output debugging information.
Clean up global scope ◦ Clear $_GET, $_POST, flush object cache ◦ Beware global scope – avoid constants (see multisite, ajax) ◦ Start a DB transaction tearDown ◦ Rollback the DB transaction Correlates @ticket annotation to Trac tickets and skips tests for known issues ◦ Works for Core, Unit Tests, and Plugin tickets
coverage Write patches for core tickets that are causing skipped/failed tests ◦ needs-unit-tests tickets ◦ Tests for any core bugs Does your plugin use a core API or action? Write a test for it so that core devs do not unintentionally break your use-case. Write tests for your plugins!