Skip to content

WP Packages is our new WPackagist replacement that's 17x faster and updates every 5 minutes

Bedrock

Roots and WP Packages are independent open source projects, supported only by developers like you. We’ve been improving the WordPress developer experience since 2011, and your support keeps it independent.

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