← Back to archive

Repo of the Day

lucatume/wp-browser

Published: Jan 14, 2022

Open repository ↗

Easy acceptance, functional, integration and unit testing for WordPress plugins, themes and sites using Codeception.

Summary

wp-browser is a PHP testing tool that extends Codeception with WordPress-specific support, letting developers run end-to-end, integration, and unit tests against WordPress sites, plugins, and themes from a single setup. The README documents version 4, which ships with a default configuration aimed at getting tests running quickly without manual environment wiring.

What it is useful for

The project is useful when you need a test harness for any of three WordPress project types: full sites, standalone plugins, and standalone themes. Because the same tool handles end-to-end, integration, and unit tests, teams can cover UI flows, PHP-level WordPress APIs, and isolated class behavior without switching frameworks. The default configuration uses SQLite via the SQLite Database Integration plugin, the PHP built-in web server on a local port such as http://localhost:8080, and Chromedriver to drive a locally installed Chrome, which avoids standing up a separate MySQL server or test database. For plugin and theme projects, the default setup also installs the latest WordPress into a tests/_wordpress directory and symlinks your code from tests/_plugins or tests/_themes into the WordPress install, so you test against a real WordPress while keeping your own files separate.

How engineers can use it

Setup is documented for three starting points. For a site, run from a folder containing both the WordPress installation files and a wp-config.php. For a plugin, run from the directory that has the plugin header PHP file. For a theme, run from the directory that has style.css with the theme header. The documented commands are:

cd my-wordpress-project
composer require --dev lucatume/wp-browser
vendor/bin/codecept init wpbrowser
vendor/bin/codecept run

After init, the README notes you can edit tests/.env for a non-default setup and points to the project docs for details. Because wp-browser is built on PHPUnit and Codeception, existing familiarity with those tools transfers, and tests run via the standard vendor/bin/codecept run command.

Documented constraints worth noting: the sqlite3 PHP extension must be active for the default SQLite-backed setup, and Chromedriver-driven tests require a local Chrome install. The README explicitly covers version 4; users on version 3 or 3.5 are directed to a separate migration guide rather than this document. Support paths listed are the docs site, the GitHub issues page, or contacting the maintainer directly.