I am updating a legacy PHP project to use composer, and implementing PHPUnit. unfortunately I have run into a few issues. When running PHPUnit
Fatal error: Class 'PHPUnit_Framework_TestCase' not found
composer.json
{
"require": {
"phpunit/phpunit": "^8.0",
"phpoffice/phpspreadsheet": "^1.6"
},
"autoload": {
"psr-4": {"Biz\\": "src/php/Classes"}
}
}
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="vendor/autoload.php"
verbose="true">
<testsuites>
<testsuite name="Random Tests">
<directory>./src/test/random/*Test.php files</directory>
</testsuite>
</testsuites>
</phpunit>
Directory structure
Command line being executed
$ ./vendor/bin/phpunit ./src/test/random/SampleTest.php
I am running it using git-bash. executing from visual studio code gives the same result. I have read, implemented the issue as described in Autoloading classes in PHPUnit using Composer and autoload.php
Test Case
<?php
class SampleTest extends \PHPUnit_Framework_TestCase {
public function testUserClassInheritance(){
global $mysqlConn;
echo "testing";
$this->assertTrue(true);
$user = new Bruger;
}
}