PHPackages                             bambamboole/acorn-testing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. bambamboole/acorn-testing

ActiveLibrary[Testing &amp; Quality](/categories/testing)

bambamboole/acorn-testing
=========================

FrankenPHP-backed Pest browser testing infrastructure for WordPress + Bedrock + Acorn projects.

0.3.1(3w ago)0277MITPHPPHP ^8.4CI passing

Since May 12Pushed 3w agoCompare

[ Source](https://github.com/bambamboole/acorn-testing)[ Packagist](https://packagist.org/packages/bambamboole/acorn-testing)[ RSS](/packages/bambamboole-acorn-testing/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (5)Versions (8)Used By (0)

acorn-testing
=============

[](#acorn-testing)

A complete browser-testing toolkit for WordPress + [Bedrock](https://roots.io/bedrock/) + [Acorn](https://roots.io/acorn/) projects: FrankenPHP-backed Pest browser tests, plus Playwright and Unlighthouse wired up with one command.

[![Latest Stable Version](https://camo.githubusercontent.com/1cdad288ca3cdd3be2080b062327ee86bf9ff28edec6f9eb7d11d14d720707c3/68747470733a2f2f706f7365722e707567782e6f72672f62616d62616d626f6f6c652f61636f726e2d74657374696e672f76)](https://packagist.org/packages/bambamboole/acorn-testing)[![License](https://camo.githubusercontent.com/d4be48b7126091563ab12df8553a59de2b9595c912d7e2aad6e21ed3e7eb1255/68747470733a2f2f706f7365722e707567782e6f72672f62616d62616d626f6f6c652f61636f726e2d74657374696e672f6c6963656e7365)](LICENSE.md)

Replaces the test driver that wraps wp-cli's single-threaded `wp server` with a [FrankenPHP](https://frankenphp.dev/) (Caddy + libphp) subprocess. Required for any flow that fans out into concurrent requests — the canonical case is the WooCommerce Blocks Store API checkout, but anything with overlapping AJAX / redirects / fragment loads hits the same limitation.

What you get
------------

[](#what-you-get)

- **`Bambamboole\AcornTesting\Testing\FeatureTestCase`** — Pest base case that boots WordPress + Acorn + Eloquent once per process and re-imports a seeded baseline dump before each test.
- **`Bambamboole\AcornTesting\Testing\BrowserTestCase`** — extends the feature base; spawns FrankenPHP and wires it into [`pest-plugin-browser`](https://pestphp.com/docs/browser-testing).
- **`Bambamboole\AcornTesting\Testing\FrankenPhpDriver`** — the actual `pest-plugin-browser` `HttpServer` implementation. Auto-downloads the binary on first use if missing.
- **`wp acorn testing:setup`** — one-shot provisioning: downloads FrankenPHP, updates `.gitignore`, installs Playwright + Unlighthouse + Puppeteer as npm dev-deps, runs `playwright install chromium`, publishes `unlighthouse.config.js`. Idempotent — safe to re-run.
- **`unlighthouse.config.js` stub** — pragmatic per-category Lighthouse budgets (Performance 80, Accessibility 95, Best Practices 90, SEO 95) and a 20-route crawl cap.
- **`.ai/` assets** — a Boost-discoverable guideline + skill that tell `wp acorn boost:update` about the package's testing conventions.

Requirements
------------

[](#requirements)

- PHP 8.4+
- WordPress 6.x with Bedrock layout (`public/` web root)
- Acorn 6.1+
- Pest 4+
- Node.js 22+ (for Playwright / Unlighthouse)

Install
-------

[](#install)

```
composer require --dev bambamboole/acorn-testing
wp acorn testing:setup
wp acorn vendor:publish --tag=acorn-testing-config
```

`testing:setup` provisions everything needed to run browser + Lighthouse tests:

1. Downloads the pinned FrankenPHP binary into `./frankenphp`.
2. Appends `/frankenphp` and `.unlighthouse/` to `.gitignore` (if missing).
3. Adds `playwright`, `puppeteer`, and `unlighthouse-ci` to `package.json` dev-deps (if missing).
4. Runs `npx playwright install chromium` so headless Chrome is on disk.
5. Publishes `unlighthouse.config.js` to the project root (if not present).

Then bind your Pest suites in `tests/Pest.php`:

```
uses(Bambamboole\AcornTesting\Testing\FeatureTestCase::class)->in('Feature');
uses(Bambamboole\AcornTesting\Testing\BrowserTestCase::class)->in('Browser');
```

And fill in project values in the published `config/acorn-testing.php` — typically `seeders`, `wp_title`, `admin_email`:

```
return [
    'seeders' => [Database\Seeders\WordPressBaselineSeeder::class],
    'wp_title' => 'My Project Tests',
    'admin_email' => 'admin@myproject.test',
];
```

That's it. `composer test:browser` (or however your project runs Pest) will spawn FrankenPHP, drive your tests, and tear it down.

Running the Lighthouse audit
----------------------------

[](#running-the-lighthouse-audit)

Wire up a single browser test that uses the `Lighthouse` builder — for example `tests/Browser/LighthouseTest.php`:

```
