Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Class 'PHPUnit_Util_Configuration' not found #51

Open
ShakeyDave opened this issue Nov 7, 2015 · 6 comments
Open

Error: Class 'PHPUnit_Util_Configuration' not found #51

ShakeyDave opened this issue Nov 7, 2015 · 6 comments

Comments

@ShakeyDave
Copy link

Hi - this could be a configuration error by me - I've been following the instructions here: [[http://blog.loftdigital.com/running-phpunit-tests-in-eclipse-pdt]] on a Windows machine, though I've adjusted them to bring things up-to-date (i.e. I've installed PHPUnit as a project dependency using Composer, not PEAR).

Here's the stack trace:

Fatal error: Class 'PHPUnit_Util_Configuration' not found in C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\DependencyInjection\PHPUnitConfigurationFactory.php on line 70

Call Stack:
        0.0000     265392   1. {main}() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\bin\testrunner.php:0
        0.0468    2725632   2. Symfony\Component\Console\Application->run() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\bin\testrunner.php:55
        0.0468    3115712   3. Symfony\Component\Console\Application->doRun() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\symfony\console\Symfony\Component\Console\Application.php:124
        0.0468    3116768   4. Symfony\Component\Console\Application->doRunCommand() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\symfony\console\Symfony\Component\Console\Application.php:193
        0.0468    3117192   5. Symfony\Component\Console\Command\Command->run() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\symfony\console\Symfony\Component\Console\Application.php:887
        0.0468    3123376   6. Stagehand\TestRunner\CLI\TestRunnerApplication\Command\PluginCommand->execute() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:252
        0.0624    4403416   7. Stagehand\TestRunner\CLI\TestRunnerApplication\Command\PluginCommand->createTestRunner() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\CLI\TestRunnerApplication\Command\PluginCommand.php:149
        0.0624    4403544   8. Stagehand\TestRunner\Core\ApplicationContext->createComponent() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\CLI\TestRunnerApplication\Command\PluginCommand.php:295
        0.0624    4403608   9. Stagehand\ComponentFactory\ComponentFactory->create() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\Core\ApplicationContext.php:104
        0.0624    4404112  10. Symfony\Component\DependencyInjection\Container->get() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-componentfactory\src\Stagehand\ComponentFactory\ComponentFactory.php:76
        0.0624    4404704  11. Stagehand\TestRunner\DependencyInjection\PHPUnitContainer->getTestRunnerService() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
        0.0780    4467296  12. Stagehand\TestRunner\Process\TestRunner->__construct() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\DependencyInjection\PHPUnitContainer.php:446
        0.0780    4467368  13. Stagehand\TestRunner\Preparer\PHPUnitPreparer->prepare() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\Process\TestRunner.php:89
        0.0780    4467448  14. Stagehand\TestRunner\DependencyInjection\PHPUnitConfigurationFactory->create() C:\eclipse\eclipse\plugins\com.piece_framework.makegood.stagehandtestrunner_3.1.1.v201409021510\resources\php\vendor\piece\stagehand-testrunner\src\Preparer\PHPUnitPreparer.php:66

I'm using the V11 x64 Thread Safe build of PHP. Could it be an issue with php-win.exe not recognising namespaces, maybe?

@ShakeyDave
Copy link
Author

I also found this video: https://www.youtube.com/watch?v=1qnWL52wt58 - which says to use php.exe as the CLI executable file, rather than php-win.exe. But it still fell over with the same error...

@ShakeyDave
Copy link
Author

The problem is clearly that Eclipse isn't finding the PHPUnit 'Library' (which is where the PHPUnit_Util_Configuration class comes from). As PHPUnit is no longer in PEAR these days, the documentation is out of date. I've installed PHPUnit as a project-level dependency using Composer - so what I need to try and work out is how to get Eclipse to find that binary. If indeed it's called a 'Binary'... Eclipse gives me the option to put Libraries on the path, and I've tried all sorts of ways of creating a Library, adding the vendor folder to it etc, but I get the same error each time.

@ktomk
Copy link

ktomk commented Aug 27, 2016

Just today I saw this error, for me it was autoload related. Sorry, I do not have an easy to tell solution for this. But for me, I was on Linux and within Phpstorm, so just to broaden the picture. It happened to me while I was tinkering with autoloaders within unit-tests. I only got this message when I put "@runInSeparateProcess" as annotation to the test.

@rauldmt
Copy link

rauldmt commented May 30, 2017

try the solution they posted here:
https://stackoverflow.com/questions/33299149/phpstorm-8-and-phpunit-problems-with-runinseparateprocess

Add to the top of your boostrap file:

if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
    define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/path/to/composer/vendors/dir/autoload.php');
}

@pallavibatra-cpi
Copy link

Just today I saw this error, for me it was autoload related. Sorry, I do not have an easy to tell solution for this. But for me, I was on Linux and within Phpstorm, so just to broaden the picture. It happened to me while I was tinkering with autoloaders within unit-tests. I only got this message when I put "@runInSeparateProcess" as annotation to the test.

@ktomk How did you figure this out. Thanks in advance.

@ktomk
Copy link

ktomk commented Jan 22, 2020

@pallavibatra-cpi Sorry I don't specifically remember. Might have been guess work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants