piece / stagehand-testrunner

A continuous test runner for CLI
https://github.com/piece/stagehand-testrunner/wiki
BSD 2-Clause "Simplified" License
35 stars 12 forks source link

Error: Class 'PHPUnit_Util_Configuration' not found #51

Open ShakeyDave opened 9 years ago

ShakeyDave commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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 commented 7 years ago

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 commented 4 years ago

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 commented 4 years ago

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