lucatume / wp-browser
A set of Codeception modules to test WordPress projects.
Fund package maintenance!
lucatume
Installs: 2 613 925
Dependents: 149
Suggesters: 1
Security: 0
Stars: 607
Watchers: 17
Forks: 86
Open Issues: 0
Requires
- php: ^8.0
- composer-runtime-api: ^2.2
- ext-curl: *
- ext-fileinfo: *
- ext-json: *
- ext-mysqli: *
- ext-pdo: *
- ext-zip: *
- codeception/codeception: ^5.0
- codeception/module-asserts: ^2.0 || ^3.0
- codeception/module-cli: ^2.0 || ^3.0
- codeception/module-db: ^2.0 || ^3.0
- codeception/module-filesystem: ^2.0 || ^3.0
- codeception/module-phpbrowser: ^2.0 || ^3.0
- codeception/module-webdriver: ^2.0 || ^3.0 || ^4.0
- druidfi/mysqldump-php: ^1.1
- phpunit/phpunit: <=12.0.0
- symfony/filesystem: >=4.4.24 <7.0
- symfony/process: >=4.4.24 <7.0
- vlucas/phpdotenv: ^5.0
Requires (Dev)
- gumlet/php-image-resize: ^1.6
- lucatume/codeception-snapshot-assertions: ^1.3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: 1.10.56
- phpstan/phpstan-symfony: ^1.3
- rector/rector: 0.19.8
- squizlabs/php_codesniffer: ^3.7
- szepeviktor/phpstan-wordpress: ^1.3
Suggests
- ext-pdo_sqlite: For SQLite database support.
- ext-sqlite3: For SQLite database support.
- dev-master
- 4.4.1
- 4.4.0
- 4.3.10
- 4.3.9
- 4.3.8
- 4.3.7
- 4.3.6
- 4.3.5
- 4.3.4
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.5
- 4.2.4
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.9
- 4.1.8
- 4.1.7
- 4.1.6
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.21
- 4.0.20
- 4.0.19
- 4.0.18
- 4.0.17
- 4.0.16
- 4.0.15
- 4.0.14
- 4.0.13
- 4.0.12
- 4.0.11
- 4.0.10
- 4.0.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- 2.2.27
- 2.2.26
- 2.2.25
- 2.2.24
- 2.2.23
- 2.2.22
- 2.2.21
- 2.2.20
- 2.2.19
- 2.2.18
- 2.2.17
- 2.2.16
- 2.2.15
- 2.2.14
- 2.2.13
- 2.2.12
- 2.2.11
- 2.2.10
- 2.2.9
- 2.2.8
- 2.2.7
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1
- 2.0.5.2
- 2.0.5.1
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.24.5
- 1.24.4
- 1.24.3
- 1.24.2
- 1.24.1
- 1.24
- 1.23.3.3
- 1.23.3.2
- 1.23.3.1
- 1.23.3
- 1.23.2
- 1.23.1
- 1.23
- 1.22.8
- 1.22.7.1
- 1.22.7
- 1.22.6.1
- 1.22.6
- 1.22.5
- 1.22.4
- 1.22.3
- 1.22.2
- 1.22.1
- 1.22.0
- 1.21.26
- 1.21.25
- 1.21.24
- 1.21.23
- 1.21.22
- 1.21.21
- 1.21.20
- 1.21.19
- 1.21.18
- 1.21.17
- 1.21.16
- 1.21.15
- 1.21.14
- 1.21.13
- 1.21.12
- 1.21.11
- 1.21.10
- 1.21.9
- 1.21.8
- 1.21.6
- 1.21.5
- 1.21.4
- 1.21.3
- 1.21.2
- 1.21.1
- 1.21.0
- 1.20.1
- 1.20.0
- 1.19.15
- 1.19.14
- 1.19.13
- 1.19.12
- 1.19.11
- 1.19.10
- 1.19.9
- 1.19.8
- 1.19.7
- 1.19.6
- 1.19.5
- 1.19.4
- 1.19.3
- 1.19.2
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.2
- 1.15.1
- 1.15.0
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.12
- 1.10.11
- 1.10.10
- 1.10.9
- 1.10.8
- 1.10.7
- 1.10.6
- 1.10.5
- 1.10.4
- 1.10.3
- 1.10.2
- 1.10.1
- 1.10.0
- 1.9.5
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.11
- 1.8.10
- 1.8.9
- 1.8.8
- 1.8.7
- 1.8.7a
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.1a
- 1.8.0
- 1.7.16a
- 1.7.15
- 1.7.14a
- 1.7.13
- 1.7.13b
- 1.7.12
- 1.7.12alpha3
- 1.7.12alpha2
- 1.7.12alpha1
- 1.7.11
- 1.7.10
- 1.7.9
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.19
- 1.6.18
- 1.6.17
- 1.6.16
- 1.6.15
- 1.6.14
- 1.6.13
- 1.6.12
- 1.6.11
- 1.6.10
- 1.6.9
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.0
- dev-v4-fix-active-plugins-activation
This package is auto-updated.
Last update: 2024-12-09 15:55:56 UTC
README
You can use wp-browser to test WordPress sites, plugins and themes.
An easy and quick setup, with a default configuration that will work for most projects, run end-to-end tests, integration tests and unit tests all with the same tool.
This document refers to version
4
of the project. If you're using version3
or version3.5
, and are looking for the migration and troubleshooting guide, you can find it here
Requirements
Depending on the nature of your project, there are different requirements it will need to satisfy before getting started.
Site
- Ensure you're running the
vendor/bin/codecept init wpbrowser
command from the root directory of your WordPress site. - Ensure the directory contains the WordPress installation files. In a standard scenario you should have extracted WordPress files in this directory.
- Ensure your installation is configured: it should contain a
wp-config.php
file.
Plugin
- Ensure you're running the
vendor/bin/codecept init wpbrowser
command from the root directory of your plugin; this should be the directory that contains the PHP file defining the plugin header.
Theme
- Ensure you're running the
vendor/bin/codecept init wpbrowser
command from the root directory of your theme; this should be the directory that contains thestyle.css
file defining [the theme header][7].
If you decide to use the quick installation, then your PHP version should have the sqlite3
extensions installed and activated. You can check this using the php -m
command and verifying the sqlite3
extension is among the active extensions.
Installation
Add wp-browser to your project as a development dependency using Composer
cd my-wordrpess-project
composer require --dev lucatume/wp-browser
Initialize wp-browser to quickly configured to suite your project and setup:
vendor/bin/codecept init wpbrowser
The command will set up your project to run integration and end-to-end tests using:
- SQLite as the database engine, leveraging the SQLite Database Integration plugin
- PHP built-in web server to serve the WordPress site on localhost (e.g.
http://localhost:8080
) - Chromedriver to drive the local version of Chrome installed on your machine
If you're working on a plugin or theme project, the default configuration will add some extra steps:
- install the latest version of WordPress in the
tests/_wordpress
directory - create a
tests/_plugins
directory: any file or directory in this directory will be symlinked into the WordPress installation intests/_wordpress/wp-content/plugins
- create a
tests/_themes
directory: any file or directory in this directory will be symlinked into the WordPress installation intests/_wordpress/wp-content/themes
For most projects this configuration will be enough to get started with testing.
You can run your tests immediately using the vendor/bin/codecept run
command.
Read more about the commands provided by the library here.
Using a custom configuration
If you decide to skip the default configuration, you will be able to set up wp-browser
to suit your needs and local
setup by editing the tests/.env
file.
The inline documentation in the file will guide you through the configuration process.
Read more about using a custom configuration here.
Getting support for wp-browser configuration and usage
The best place to get support for wp-browser is the project documentation.
Since this project builds on top of PHPUnit and Codeception, you can also refer to their documentation.
If you can't find the answer to your question here you can ask on the "Issues" section of the wp-browser repository taking care to provide as much information as possible.
Finally, you can contact me directly to set up a call to discuss your project needs and how wp-browser can help you.
Sponsors
A thanks to my sponsors: you make maintaining this project easier.