Create a PHP Function
Learn how to create a PHP function to run a unit test.
We'll cover the following...
In this lesson, we’ll create a PHP function and make our new web page use it. This function will be used for PHPUnit testing later on in the course.
Add a PHP function
First, let’s create a simple testable PHP function.
- In the widget below, find the
src/Controller/NewPageController.php
file. - Add the new function.
public function personalMessage(): string
{
return "PHP is cool";
}