A First Test

Let's add a simple test to check if everything is working fine.

We'll cover the following...

Creating a new test file

When first installing a test runner like PHPUnit, it is a good idea to add a very simple test to show that everything is set up correctly. Let’s start by creating a new file called tests/HomepageTest.php. This file should contain the following code:

Press + to interact
<?php
use PHPUnit\Framework\TestCase;
final class HomepageTest extends TestCase
{
/**
* @test
*/
public function phpunit_works(): void
{
self::assertTrue(true);
}
}

Running the test

In the Terminal ...