tester
The PHP Version Tester module provides automated Drush commands to crawl your Drupal site and identify PHP compatibility errors. This tool helps developers safely upgrade PHP versions by testing all site pages for errors, warnings, and notices before going live.
Features
The module automatically crawls your site using configurable test plugins to identify PHP errors across different page types. Key features include:
- Comprehensive Site Testing: Tests home pages, node pages, menu links, user pages, and custom error pages (403/404)
- Flexible Authentication: Supports admin login via one-time links or username/password authentication
- Configurable Crawling: Set limits on URLs to crawl, specify which menus to test, and choose specific test plugins
- Error Reporting: Detailed error logs with HTTP status codes and PHP error messages captured from watchdog
- Plugin Architecture: Extensible system with built-in plugins for nodes, menus, users, and system pages
Form testing
The new tester:forms command will crawl the site looking for forms that allow input from anonymous users.
Use this module when upgrading PHP versions to ensure your site will run without errors. It's particularly valuable for major PHP version transitions (like PHP 7.4 to 8.x) where compatibility issues are common.
The module includes a test error generator submodule (tester_error_generator) useful for testing the error detection functionality during development.
Post-Installation
After installation, the module works entirely through Drush commands - no configuration UI is required:
- Enable the module:
drush en tester - Run basic site test:
drush tc(uses current site URL) - Test specific URL:
drush tc https://example.com - Run all tests:
drush tc --test=all - Limit crawling:
drush tc --test=all --limit=50 - Login as admin:
drush tc --admin - View only errors:
drush tc --errors
The module automatically enables database logging (dblog) during tests and sets error reporting to maximum level to capture all PHP issues. These settings are restored after testing completes.
Additional Requirements
- Drupal Core: 10.x or 11.x
- Drush: Required for all functionality (module provides Drush commands only)
- Database Logging (dblog): Automatically enabled during testing to capture PHP errors
- cURL/Guzzle: Used for HTTP requests (included with Drupal core)
No external libraries or APIs are required beyond standard Drupal dependencies.
Recommended modules/libraries
- Drupal Check: Complements this module by providing static code analysis for PHP compatibility
- Examples module: Helpful for understanding plugin architecture if extending the module
- Admin Toolbar: Makes navigation testing more comprehensive when using admin login features
Similar projects
While tools like Drupal Check provide static code analysis for PHP compatibility, the Tester module is unique in providing dynamic testing by actually loading pages and capturing runtime errors. This catches issues that static analysis might miss, such as errors in contributed modules or theme templates that only occur during page rendering.
Supporting this Module
Support development through:
- Contributing patches and improvements on Drupal.org
- Testing with different PHP versions and reporting issues
- Documenting use cases and creating tutorials