Download the PHP package alvarodelera/pest-wp-plugin without Composer

On this page you can find all versions of the php package alvarodelera/pest-wp-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pest-wp-plugin

PestWP - Pest Plugin for WordPress

Tests

A modern testing plugin for WordPress using Pest PHP with SQLite database support and automatic database isolation.

Features

Requirements

Installation

Quick Start (< 5 minutes)

Get your first WordPress test running in under 5 minutes:

1. Add PestWP to your project

2. Create your first test

3. Configure Pest

4. Run your tests

That's it! PestWP automatically:

Testing Your WordPress Plugin

If you're developing a WordPress plugin and want to test it with PestWP, you need to configure Pest to load your plugin when WordPress boots.

Basic Plugin Configuration

Complete Configuration Example

For a full-featured plugin test setup:

Example Plugin Test

Project Structure

Recommended test structure for a WordPress plugin:

Basic Test Example

Integration vs Browser Testing

PestWP supports two types of testing. Choose the right one for your needs:

Feature Integration Tests Browser Tests
Speed ⚡ Very fast (~2ms/test) 🐢 Slower (~500ms/test)
Database SQLite (automatic) MySQL (requires setup)
UI Testing ❌ No ✅ Yes (full browser)
JavaScript ❌ No ✅ Yes
Setup Zero config Requires WordPress server
Best For Hooks, filters, CRUD, permissions Admin UI, Gutenberg, forms

When to Use Integration Tests

Use integration tests for:

When to Use Browser Tests

Use browser tests for:

Type-Safe Factory Helpers

PestWP provides strongly-typed factory functions for creating WordPress objects:

Create Posts

Create Users

Create Terms

Create Attachments

Authentication Helpers

PestWP provides convenient helpers for testing authentication and user permissions:

Login as User

Logout

Check Current User

Testing Different User Roles

Custom WordPress Expectations

PestWP extends Pest's expectation API with WordPress-specific assertions for more readable and expressive tests.

Post Status Expectations

Check post statuses with intuitive methods:

Available status expectations:

WP_Error Expectations

Test WordPress errors elegantly:

Metadata Expectations

Test post and user metadata:

Hook Expectations

Test action and filter registrations:

Term Expectations

Test taxonomy term assignments:

Chaining Expectations

All custom expectations support chaining:

Database Isolation

Every test automatically runs in an isolated database transaction. Changes are rolled back after each test:

Browser Testing (E2E)

PestWP integrates with Pest Browser Plugin for browser-based end-to-end testing of your WordPress site.

Quick Setup

Features

Example Browser Test

Running Browser Tests

Browser Configuration

The getBrowserConfig() helper reads configuration from your tests/Pest.php or environment variables:

Or use environment variables:

WordPress Environment Setup

Browser tests require a running WordPress instance (unlike integration tests which use SQLite). Here are common setups:

Option 1: wp-env (Recommended for WordPress development)

wp-env is the official WordPress local environment tool.

Option 2: Docker Compose

Create a docker-compose.yml for isolated testing:

Option 3: Local by Flywheel / MAMP / XAMPP

If you have a local WordPress installation:

Option 4: wp-browser (Advanced)

For projects already using wp-browser, you can configure PestWP to use the same WordPress instance:

Integration Tests vs Browser Tests: Which WordPress?

Test Type WordPress Instance Database
Integration Auto-installed in .pest/wordpress/ SQLite (isolated)
Browser Your running server (Docker, wp-env, etc.) MySQL/MariaDB

Important: Browser tests interact with a real WordPress installation. Changes made during browser tests persist unless you reset the database manually or use a fresh container.

WP Admin Locators

PestWP provides helper functions for building URLs and CSS selectors for WordPress admin UI elements. These locators are designed to be resilient across WordPress versions (6.5+).

URL Helpers

Gutenberg Selectors

Admin UI Selectors

For complete browser testing documentation, see docs/BROWSER_TESTING.md.

Configuration

The plugin works out of the box, but you can customize it in your tests/Pest.php:

Project Structure

Development

How It Works

  1. Auto Installation: On first run, PestWP downloads WordPress and SQLite integration plugin
  2. Bootstrap: Pest automatically loads WordPress with SQLite before running tests
  3. Isolation: Each test runs with automatic database snapshots (~1.7ms overhead)
  4. Type Safety: Factory helpers provide full IDE autocompletion and static analysis

Troubleshooting

Common Issues

Tests fail with "WordPress not found"

PHPStan memory errors

Browser tests timeout

Database isolation not working

Debug Mode

Enable verbose output for troubleshooting:

GitHub Actions (CI/CD)

PestWP includes ready-to-use GitHub Actions workflows for continuous integration.

Quick Setup

Copy the simple workflow to your project:

Full Workflow Template

For a complete workflow with code quality checks, matrix testing, and browser tests, copy:

This includes:

Running Browser Tests in CI

Browser tests require a running WordPress instance. The full workflow uses Docker services:

Enable browser tests by including [browser] in your commit message, or run them on a schedule.

Credits

License

MIT License. See LICENSE for details.


All versions of pest-wp-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
pestphp/pest Version ^5.0
pestphp/pest-plugin Version ^5.0
pestphp/pest-plugin-browser Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alvarodelera/pest-wp-plugin contains the following files

Loading the files please wait ...