From the course: Building PHP Applications with Generative AI

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Writing unit tests with AI

Writing unit tests with AI

- [Instructor] One great way AI can help us test is by actually writing the unit tests. A unit test tests a specific component of an application. In PHP, this could be functions or methods inside of a class. These are great for testing to make sure you're getting the expected results before building important aspects of an application on top of those functions. Let's create a unit test using the Person class from an earlier video. And I should point out that I have PHPUnit installed and configured on my machine. If you want more guidance on how to install and use it, check out our videos on unit testing and PHPUnit in the LinkedIn Learning Library. So let's go to our files here in VS Code. You can see in the repo there will be some composer files that are used to properly configure PHPUnit. So now we will say, "Please create..." Actually, let's make sure we have our Person class open and I will just make sure the entire text is highlighted. So I'll say, "Please create a unit test for…

Contents