01. Introduction and demo


So welcome to Up and Running with PEST. In this course, we're going to build out a real world application and write tests alongside it using PEST.
PEST is a testing framework for PHP, not specifically for Laravel. So we're going to be leaning on a lot of Laravel testing functionality that's already available to us. But we'll be covering pretty much every PEST feature.
So once you're done with the course, you'll be able to comfortably write tests with PEST and leverage nearly all of its features. Okay, so let's take a look at the application that we're going to be building and we'll run the tests that we're going to be writing together as well.
So the app that we're going to be building is Book Friends, which is essentially a way to sign up, add books that you are either wanting to read, currently reading or have read, and you can share that with your friends.
So we're going to be building out and of course testing a friend system as well. So we can add a friend, accept a friend request. So that's a pretty big feature of this course. So I'm going to go ahead and just sign up here.
Let's go ahead and just write my name in here and my email address. And I'll go ahead and choose a password. And there we go. We've got a feed here which will show us all of our friends
and the books that they're currently reading. We've got a list of our books, which at the moment is empty. We can add a book, which we're going to take a look at. And we can look at our friends list and of course add a friend as well.
So let's go ahead and first of all add a book. So let's just call this example book one. And we'll just put example author one. Just keep things simple.
And I'll just say I want to read this book. So once we've added that over on the my book section, you can see that we've got this book in here under this want to read section. We can edit that.
So if this changes to the fact that we're reading it, we can do that as well. And if we just add another book, example book two, and we'll just copy and paste that down, example author two, and I say read, then you can see that these come under different headings.
Now let's hop over to another browser window and we'll go ahead and sign up with a completely different user. So let's say mabel at and again add a password in. Now this user of course doesn't have any books
and we don't have anything in the feed. If we head over to the friends section though and we add my email address and we hit send a friend request, we now get a list of pending friend requests.
We can cancel that if we want to and re-add it in. And let's go over to here and go over to our friends list. So you can see here we've got a list of friend requests which we can go ahead and accept.
So once we do accept this friend request and we come over to Mabel's account, you can now see that comes under this friends heading. And if we head over to the feed, you can see here Alex has read example book two. So this is now in past tense and you can see that book there
and it tells you when as well. So what we can do is just come over and edit this. So let's come over to Alex's account and let's go over to our books and let's set reading to read.
And let's hop back over and give that a refresh. And there we go. So Alex has read example book one one second ago. So that's all going to keep up to date.
And of course we can manage our friends by unfriending them if we want to and all that stuff. So let's take a look at some of the tests that we're going to write. If we just go ahead and open this up,
you can see we've got a huge amount of feature tests. We're going to focus on feature tests here, but we are going to write some unit tests specifically around the friend functionality. And that's where pests expectations come in.
But most of these are going to be feature tests. And we're going to try and pack as many pest features into this in the correct context so we can see how pest shines. And to run the tests, of course, which is really important,
we're going to go ahead and use pest. And you can see here that's going to run through all of these. And we have written a total of 48 tests. And they have all run and, of course, have all passed.
So there we go. That is the example app that we're going to be building. Pretty simple. The most complex part about this is the friend functionality,
which we're going to be thoroughly unit testing. But that's what we're going to be building and learning pest along the way. So let's head over to the next episode, get a fresh Laravel project set up and get pest up and running.
35 episodes4 hrs 19 mins


Pest is a PHP testing framework that brings beautifully simple syntax to your tests, without sacrificing on features. In this course, we'll get up and running with Pest in a Laravel project and write tests for a real-world application that we'll build along the way.

You'll learn how to set Pest up in a Laravel project, write tests with Pest's built-in assertions, generate code coverage, and more.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!


No comments, yet. Be the first to leave a comment.