Looks to me your phpunit configuration is not setup to autoload your libraries. I believe you shouldn't have moved your code from the vendor/
directory to a library/
directory, as this is automatically configured by Composer (since you have a vendor/
directory I assume you also use Composer) so with each update of your "vendor" packages, you now need to copy/paste stuff over.
The beauty of Composer is that within the vendor/
directory it also creates an autoload.php
file, which you can use as bootstrap (or include in another bootstrap) file for phpunit.
Example bootstrapping just the vendor packages (if phpunit.xml is in app root):
<?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="vendor/autoload.php" haltOnFailure="true" haltOnError="true">
...
</phpunit>
Example bootstrapping project bootstrap in src/
(if phpunit.xml is in app root):
<?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="src/MyProject/Bootstrap.php" haltOnFailure="true" haltOnError="true">
...
</phpunit>
The bootstrap for this example project might look like the following:
<?php
defined ('APP_ROOT') ||
define('APP_ROOT', dirname(__DIR__) . '/../');
$paths = array (
APP_ROOT . '/src',
APP_ROOT . '/vendor',
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $paths));
/**
* @see autoload.php
*/
require_once 'autoload.php';
...