1
votes

i'm trying to use Skeleton Generator but every time i try to use it i receive the error below:

Fatal error: Class 'SebastianBergmann\PHPUnit\SkeletonGenerator\CLI\Application' not found in [path_to_project]/vendor/phpunit/phpunit-skeleton-generator/phpunit-skelgen on line 63

THE CONTEXT

I've installed SkeletonGenerator through Composer.

The not found class in reality exists in the path /vendor/phpunit/phpunit-skeleton-generator/src/CLI/Application

I don't understand why the class exists but it isn't seen.

What can i do to solve the problem? Is it related to the autoloading of packages by composer?

GitHub issue: https://github.com/sebastianbergmann/phpunit-skeleton-generator/issues/46

1
Please post your code to show how you call this class. Did you use a use ...; line in order to import the class? - A.L
Code? I use the terminal, something like > php /[path_to_project]/vendor/bin/phpunit-skelgen --test ClassName /[path_to_project]/[path_to_file]/class.php - Aerendir
In the mean time i have also opened a ticket on GitHub for this: github.com/sebastianbergmann/phpunit-skeleton-generator/issues/… - Aerendir

1 Answers

0
votes

A place to start would be this line in the phpunit-skelgen file:

foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {

Make sure that the autoload.php file(s) referred to actually exist. The way to test is to add something like:

echo __DIR__ . '/../../autoload.php' . "\n";

...before foreach loop and see if what it spits out is actually in your file system. I am using Laravel 5, and the autoload.php is located in a directory called "bootstrap". I changed it to this:

foreach (array(__DIR__.'/../bootstrap/autoload.php', __DIR__ . '/../vendor/autoload.php') as $file) {

...and was able to take things to the next step (still not able to generate a skeleton test, but there are other issues).