Book Overview

Imagine you are working on a Laravel side-project or you just joined a team working on a Laravel application, and it currently doesn't have a single test. You want to change that, and add tests to the application. If you find yourself in this situation, you might not even know where to start. “Should I unit test everything? Should I just test the most critical parts of the application?” You might even find yourself asking “Why do I need tests in the first place?

My main goal with this ebook is to try to answer these questions, and I will describe my process in writing tests for some of the Laravel applications I’m working on (mainly CRUD applications).

Chapter 1: Introduction

In this chapter we will discuss why we are writing fewer tests than necessary, why do we need tests in the first place, and what should we be testing exactly

Chapter 2: What should we be testing in a Laravel CRUD application?

In this chapter, we are going to answer this question and describe what we will be testing in the rest of the ebook.

Chapter 3: Writing tests for guest user functionalities on a Laravel CRUD application

In this chapter we will start writing tests for our demo application by testing what a guest can do.

Chapter 4: Testing what signed up users could do on the application

In this chapter we are going to focus on the signed up users, but we will be working on just what the logged in users could do

Chapter 5: Testing what a logged in user is not allowed to do

In this chapter we will test what the user is not allowed to do since testing for this kind of functionalities is as important as the functionalities the users are allowed to do.

Chapter 6: Refactor the tests and create a base test class

In this chapter, we will look at how we can clean the code we wrote so far, and we will see how this will eventually help us write any further tests much quicker.

Chapter 7: Dealing with test data

In this chapter, we will explore how we would deal with test data in general.

Chapter 8: Set up a Continuous integration tool

In this chapter we will set up a continuous integration tool that will inform us any time we push a code that breaks the app functionalities.

Chapter 9: Conclusion

Closing chapter.



  • "As someone who agrees with Guillermo Rauch's quote "Write tests. Not too many. Mostly integration", this book from Youghourta does explain integration tests in a practical manner, if you finally want to embrace tests in your project without feeling you're wasting your time, you'd be serious about this book. "

    - Walid Ziouche
    Software Engineer
  • "It's very practical, showing and assuming how a real world application would change over time and how testing would help mitigate errors that might happen.
    I also like how the author didn't just throw couple tests and walked away, but he stayed and did refactoring on the tests and showed us how it should be done then integrated everything with a Continuous Integration tool."

    - Ammar Alakkad
    Full-stack Web Developer
  • "Testing always seemed intimidating to me. With this ebook, Youghourta does a great job demystifying all of its concepts and breaking them down into digestible, easy-to-understand chapters. I recommend this ebook for anyone looking for an intro to the world of testing in Laravel."

    - Majda Nafissa Rahal
    Associate Director, Shift'IN