-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Code coverage problem: Fatal error: Class 'PHP_Token_Stream' not found #353
Comments
I cannot reproduce this. |
I have just come up against this exact bug under OSX Lion |
Can you post your php include path? Is /usr/share/php/ in it? |
That path actually doesn't exist on my system ... As is clear from this path, I used homebrew to install php |
Okay, then where have you installed PHPUnit and where is your PHP/Token/Stream directory located? Make sure all these are under the php include path(adjust that path in php.ini if necessary) so that autoloader can find them. If class name is PHP_Token_Stream autoloader will try do include("PHP/Token/Stream.php"); |
My response to your first question actually got me thinking - it didn't make sense that my include_path was missing the normal paths, so I went digging - it looks like I'm having problems with autoloading class files. Thanks for the responses though |
@gpkamp figured the problem is resolved by manually including My problem was gone by re-installing everything, I blame PEAR for original issue :) |
I've tried reinstalling alright, but it made no difference. Anyway, after figuring out I needed this line: '''require 'PHPUnit/Autoload.php';''' (but I didn't need it before this morning ...), I now have another error: Generating code coverage report, this may take a moment.PHP Fatal error: Class 'PHP_Token_OPEN_TAG' not found in /usr/local/share/pear/PHP/Token/Stream.php on line 205 Things are getting awfully strange here... |
Just to note - adding: |
Hey Daniel, same problem here. What's your PEAR and PHP version? And yes, adding your require_once to the top of PHP/Token/Stream/CachingFactory.php hacks that into submission. |
PHPUnit 3.5.15 on OSX + nginx/php-fpm/mysql/mongo ;) A colleague, who is having no problems at all, reports this: |
@danielhunt Can confirm, adding require_once('PHP/Token/Stream/Autoload.php'); solved the issue for me, too (thanks!). |
Nothing from @sebastianbergmann on this? :) |
I cannot reproduce this, sorry. And PHPUnit 3.5 is no longer supported, also sorry. |
... that's so odd :/ (cheers for the quick response) |
Used the steps at http://dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/ to get the correct versions and dependencies for installing PHPUnit 3.5.15 |
Adding the snippet of code also worked for me. |
I managed to reproduce your error in parts. I corrected the problem by deleting the directories and PHP and PHPUnit downloading again through the pear command. |
Downgraded the version of PHP_TokenStream to 1.0.1 and worked for me. |
Thanks a lot @amitchhajer! Work for me! ;) |
5 years later and I am running accross the very same problem. The Class does exist! Generating code coverage report in HTML format ...PHP Fatal error: Class 'Acme\Controllers\BaseController' not found in /var/www/html/src/Controllers/ |
Found the solution. Adding the composer autoload.php to PHPUnit xml config file, as is:
|
I am running PHPUnit 3.5.15 on a freshly installed Ubuntu 11.04 64bit. Tests are running fine, however, when trying to run code coverage as well, an error is thrown:
I have manually included missing file in
/usr/share/php/PHP/Token/Stream/CachingFactory.php
for debugging purposes, the diff isRunning the same test again results in following error:
Has anyone experienced this behaviour? I'll try looking into it more closely in the upcoming days.
The text was updated successfully, but these errors were encountered: