PHPUnit not working for builds?

So I’m trying to setup the GitLab Runner to initiate PHPUnit tests before allowing a deployment of a website change in PHP to the server. However, I’m running into trouble with the runner once it starts the tests. It appears that it goes through the entire process of installing PHPUnit, Git, etc. (as recommended in the docs), but it’s failing right when it starts running the tests. Here’s the output:

$ phpunit --configuration websiteTests.xml --coverage-text

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /builds/LegendOfLegaia/legendoflegaia.net/Tests/GuestTest.php on line 5

So although phpunit sets up all the ‘includes’ as defined in my bootstrap file (which simply includes all the files that would be required for testing), it fails because it’s saying the class for PHPUnit doesn’t exist. I read online for several solutions. The main one being to add a “composer.json” file to the project, but I’m not using a composer.json… I followed the instructions on GitLab’s documentation here : https://docs.gitlab.com/ce/ci/examples/php.html and am not sure what’s going on that would make it not see PHPUnit’s class. Any assistance? :slight_smile:

Figured it out. It required adding this at the top of my Test files:

use PHPUnit\Framework\TestCase;

And then simply extending “TestCase” instead of “PHPUnit_Framework_TestCase” on all the test files. :slight_smile: