Laravel Packages

Laravel Expectations Plugin for Pest

Published
Laravel Expectations Plugin for Pest image

Pest Laravel Expectations is a Pest plugin that adds Laravel-specific expectations to the testing ecosystem:

it('can check model exists', function(){
$user = User::factory()->create();
 
expect($user)->toExist();
});
 
test('user can edit a post', function(){
$user = User::factory()->create();
 
expect($user)->toBeAbleTo('edit', $post);
});
 
 
test('home is rendered', function () {
$response = get('/home');
 
expect($response)->toBeSuccessful();
});

This plugin includes different expectations across the following Laravel features:

  • Authentication
  • Collections
  • Database
  • Exceptions
  • Models
  • Response
  • Storage
  • Time
  • Views

To get started, check out the documentation for a complete list of expectations with examples. Also, you can get the full source code at defstudio/pest-plugin-laravel-expectations.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
Laravel monitoring that doesn't bill you by your traffic image

Laravel monitoring that doesn't bill you by your traffic

Read article
Mock PHP Classes in Tests With the Double Library image

Mock PHP Classes in Tests With the Double Library

Read article
Laravel Discount: Coupon Codes, Usage Limits, and Stacking image

Laravel Discount: Coupon Codes, Usage Limits, and Stacking

Read article
Laravel Truss: Live Interactive Database ER Diagrams image

Laravel Truss: Live Interactive Database ER Diagrams

Read article
Laravel artisan dev: Run Server, Queue, Logs, and Vite image

Laravel artisan dev: Run Server, Queue, Logs, and Vite

Read article
Validate and Convert HEIC Images in Laravel image

Validate and Convert HEIC Images in Laravel

Read article