Black Friday: coupon FRIDAY24 for 40% off Yearly/Lifetime membership! Read more here
Courses

Testing in Laravel 11: Advanced Level

  • 31 lessons
  • 14713 words

This content is available only for premium members.

About this course

This is a follow-up course to the previously released Testing in Laravel For Beginners.

I deliberately separated them because there are two different audiences for testing:

  • Devs who haven't started testing or have minimal experience
  • Devs already familiar with core principles but lack practical experience and want to dive deeper

This course is also a new text-based version of the older video course from 2022, updated to the newest Laravel 11, Pest 3 and other syntax.


This advanced testing course will cover the following topics.

  • GitHub Actions. I'll start by motivating you to write more tests because you can automate running them with GitHub actions

  • Finding Assertions. One of the biggest struggles for people is to choose the correct assertions. I will show you more assertions and the difference between some of them.
actingAs($this->user)
    ->get('/products')
    ->assertStatus(200)
    ->assertSee($product->name); 
    // Or better `assertSeeText()`?
  • Testing Laravel features. You need to learn how to test specific structures in Laravel, such as Exceptions, File Downloads, Artisan commands, Jobs, Eloquent, and HTTP requests.
$this->artisan('page:publish', ['id' => 1])
    ->assertFailed()
    ->expectsOutputToContain('Not found');
  • Testing External Stuff. Probably the most requested topic for this course: mocking, testing external services, testing external APIs, third-party APIs, and faking stuff within the Laravel framework itself.
$this->mock(YouTubeService::class)
    ->shouldReceive('getThumbnailByID')
    ->with('5XywKLjCD3g')
    ->once()
    ->andReturn(...);
  • Finally, along the way, I will show you random testing tips.
php artisan test --stop-on-failure

So, are you intrigued? Let's start with the FREE first lesson about GitHub actions.