Testing with Pest PHP

Laravel Testing Series Part 2: Mastering Pest PHP

Write clean Laravel tests in Pest PHP: expectations, hooks, datasets and higher-order tests for real CRUD and auth cases.

Laravel Testing Series Part 2: Mastering Pest PHP

Who this course is for

  • Laravel developers who want to write clean, reliable tests using Pest PHP
  • Students who completed Part 1 of the Laravel Testing Series using PHPUnit & Xdebug
  • Developers looking to transition from PHPUnit to Pest with confidence
  • PHP developers interested in applying modern testing workflows in real projects
  • Anyone who wants to build robust Laravel applications with full test coverage
  • Intermediate Laravel users who want to level up their testing skills in a practical way
  • Professionals looking to stand out as Laravel experts in the industry

What you'll learn

  • Master modern testing in Laravel using Pest PHP, the elegant alternative to PHPUnit
  • Understand the differences between PHPUnit and Pest PHP and when to use each
  • Understand the key differences between feature and unit testing in Laravel
  • Refresh your testing fundamentals with a quick PHPUnit recap module
  • Configure Pest from scratch and integrate it smoothly into Laravel projects
  • Use expectations effectively and build custom expectations for your project needs
  • Use test hooks, datasets, and global hooks to write flexible, maintainable tests
  • Organize and manage large test suites using skipping, grouping, and filtering
  • Create custom helpers and implement higher-order testing patterns
  • Plan and implement real-world test cases for CRUD operations like categories
  • Validate form input using dataset-based validation testing
  • Write clear and secure tests for authorization and role-based access
  • Build confidence in writing test-driven Laravel code using modern practices
  • Continue your journey from the PHPUnit & Xdebug course with a more powerful workflow

Topics covered

An overview of the main modules. See the course page on Udemy for the full, up-to-date curriculum.

1

Introduction

2

Quick Testing Refresh

3

Basics - Hooks & Datasets

4

Basics - Skipping, Grouping & Filtering

5

Basics - Custom Helpers & Higher Order Testing

6

Planning Categories Test

7

Category Retrieval Test

8

Category Creating Test & Validation

9

Category Updating Test & Validation

10

Category Deleting & Authorization Test

11

Finalizing the course

Prerequisites

  • Basic understanding of Laravel is required
  • Basic understanding of models, seeders, migrations and basic CRUD operations is required
  • Knowledge of Laravel's basic features like Eloquent ORM, Blade templating, and middleware
  • Any computer and OS will work — Windows, macOS or Linux

Your instructor

Mahmoud Anwar

Mahmoud Anwar

Senior Laravel/PHP developer and technical educator specializing in backend engineering, with 21+ programming courses created for developers worldwide.

More about Mahmoud
Keep going
Next step

Have a technical challenge?

Tell me about your application, your goals and your constraints. We'll work out the right next step together.