This episode is for members only

Sign up to access "Build an Appointment Booking System With Laravel" right now.

Get started
Already a member? Sign in to continue
Playing
02. Fresh project with Pest

Episodes

0%
Your progress
  • Total: 4h 49m
  • Played: 0m
  • Remaining: 4h 49m
Join or sign in to track your progress

Transcript

00:00
okay this might be pretty obvious to you but we're going to go ahead and set up a fresh Laravel project now with pest we're going to run these tests so we make sure that everything is working then we can get building okay so we're going to go ahead and use the Laravel installer to create a new
00:12
project called Laravel booking system let's go ahead and choose no starter kit here and of course we'll choose pest for our tests although you can change that over to phpunit and we won't initialize a git repository just yet okay so once that's done we're going to go ahead and choose mysql as
00:26
our database and we're just going to wait for everything to finish up okay now that's done let's open our project up and we can get started on doing everything that we need to do so let's go ahead and run our migrations first just to get them out and running we
00:39
don't have the database created so let's create that first of all and if we add over to the database you can see we've just got the standard stuff in here okay so in terms of running our pest test the first thing that we're going to do is come over to
00:52
phpunit.xml and we're going to make sure that we are using xqlite and the in-memory database drive that's really important so we don't go ahead and insert anything into our actual database while we're testing
01:07
so if you're new to testing and you're new to pest let's go over to our test directory and you can see that we've got two example tests already here written in the pest functional style so we can go ahead and just run pest on the command line if you don't
01:21
already have this you might need to go ahead and create an alias for this something like this and save that out and let's go ahead and run pest so there we go we've got two tests working and of course that shouldn't have created anything in the database because
01:35
we've now swapped this over to use xqlite so before we get started i'm going to go ahead and get rid of these two tests we can use the command line to create any tests that we need a little bit later on and to be honest that is pretty much it we should now have
01:49
an application up and running that we can start to build our core functionality in so in the next section we're going to focus on this core functionality and we're going to build up all of these custom classes that we need to get this working
02:01
and then once we've done that we can go ahead and build the ui on top of it so there we go a really simple lara application setup our tests are running so we can make sure everything's working properly and still working if we make any changes

Episode summary

In this episode, we kick things off by setting up a brand new Laravel project using the Laravel installer. We name our project "Laravel Booking System" and purposely skip the starter kit so we can start from scratch. For our testing setup, we opt for Pest, which offers a nice and clean testing experience.

We then move on to setting up our database, choosing MySQL for the main system. We make sure to run migrations (after creating the database, of course) so that everything is ready to go for development.

An important bit covered here is swapping the test database driver to use SQLite in memory, rather than hitting our actual database. This helps keep our tests clean and isolated from our real data. You'll see how to check the phpunit.xml to make that adjustment, so you don't end up with unwanted test data in MySQL.

We then take a look at the default Pest tests that arrive with the project. We run Pest to make sure everything's wired up and working, and talk about how you might need to create an alias for Pest if it isn't set up for you already.

Finally, we clean up the default example tests and talk through how this fresh setup leaves us ready to build our core features. In the next episodes, we'll dive into building out our app's custom functionality—and after that's in place, we'll tackle the UI!

So by the end of this intro, you’ll have a fully functional Laravel app with Pest tests ready to support you as you build out your booking system.

Episode discussion

No comments, yet. Be the first!