Skip to content
Bedrock

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Testing Bedrock with Pest

View as Markdown:

Bedrock includes a minimal testing setup based on Pest (powered by PHPUnit).

Running tests

Run the test suite from your Bedrock root:

$ composer test

Default test structure

Bedrock ships with these testing files:

  • phpunit.xml.dist - PHPUnit configuration used by Pest
  • tests/Pest.php - Pest bootstrap and shared test configuration
  • tests/Feature/ExampleTest.php - Example test

Writing tests

Add tests anywhere under tests/:

<?php

test('home URL is configured', function () {
    expect(env('WP_HOME'))->not->toBeEmpty();
});

Then run:

$ composer test

Scope of the default setup

The default setup is intentionally minimal and framework-agnostic:

  • It gives you a ready-to-run PHP testing baseline
  • It does not include WordPress core integration test bootstrap or database test provisioning

If you need deeper WordPress integration testing, you can extend this baseline with your preferred tooling.

Last updated