Skip to main content
Version: 1.x

Testing: Pest

Mantle's Testing Framework supports running unit tests via Pest via the alleyinteractive/pest-plugin-wordpress plugin. Pest tests using Mantle can be run with or without the rest of the framework.

Pest Logo

Let's take a look at a quick example of a Pest test case using Mantle:

use function Pest\PestPluginWordPress\from;
use function Pest\PestPluginWordPress\get;

it( 'should load the homepage', function () {
get( '/' )
->assertStatus( 200 )
->assertSee( 'home' );
} );

it( 'should load with a referrer', function () {
from( 'https://laravel.com/' )
->get( '/' )
->assertStatus( 200 );
});

For more information, checkout the plugin's GitHub.