Writing Tests for the Tours: Create a New Tour
Let's try to write a test for creating tours and see why we should remove existing data before running the tests.
Adding a test for creating a new tour
We will write tests for the tours in a new file called tests/ToursTest.php
.
We could start by creating a new tour and verifying if it shows up in the list of tours.
We should use the client to go to /create-tour
, provide some form data, submit it, and then go to /list-tours
to verify that the new tour shows up in the list of tours.
Get hands-on with 1400+ tech skills courses.