Symfony2 Gregwar / CaptchaBundle Fatal error - symfony

I did all steps from
https://github.com/Gregwar/CaptchaBundle
Added to composer.json and updated, config.yml enabled the bundle But I get fatal error
Fatal error: Class 'Gregwar\CaptchaBundle\GregwarCaptchaBundle' not found in /var/www/Surgery/app/AppKernel.php on line 26 Call Stack: 0.0000 228784 1. {main}() /var/www/Surgery/web/app_dev.php:0 0.0037 1211816 2. Symfony\Component\HttpKernel\Kernel->handle() /var/www/Surgery/web/app_dev.php:25 0.0037 1212000 3. Symfony\Component\HttpKernel\Kernel->boot() /var/www/Surgery/app/bootstrap.php.cache:614 0.0037 1212160 4. Symfony\Component\HttpKernel\Kernel->initializeBundles() /var/www/Surgery/app/bootstrap.php.cache:569 0.0037 1212864 5. AppKernel->registerBundles() /var/www/Surgery/app/bootstrap.php.cache:797
I have little problems after update my ubuntu. I' using sf 2.1.6.

I have the same problem with Symfony2.1. I did composer install. I noted that in my output console there was not captcha bundle installed. I fixed the problem with
composer update

In case of somebody bumped into my (similar to this one) problem.
I took code from https://github.com/Gregwar/CaptchaBundle and did all steps (downloaded by git clone). I put the code into \vendor\bundles\Gregwar\CaptchaBundle\
Finally when i got an error
Error: Class 'Gregwar\Captcha\CaptchaBuilder' not found in
D:...\app\cache\dev\appDevDebugProjectContainer.php line
1598
i downloaded another code from https://github.com/Gregwar/Captcha/ and put it into \vendor\bundles\Gregwar\Captcha\
and everything went ok. Hope this will help anybody

Related

PHPUnit stopped running

I've come back after the weekend to the following error:
Fatal error: Uncaught Error: Class 'PHPUnit\Runner\TestSuiteSorter' not found in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1143
Error: Class 'PHPUnit\Runner\TestSuiteSorter' not found in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1143
Call Stack:
0.0030 403784 1. {main}() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/phpunit:0
0.0136 899376 2. PHPUnit\TextUI\Command::main() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/phpunit:53
0.0137 899488 3. PHPUnit\TextUI\Command->run() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/Command.php:155
0.0519 2873464 4. PHPUnit\TextUI\TestRunner->doRun() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/Command.php:200
0.0519 2873488 5. PHPUnit\TextUI\TestRunner->handleConfiguration() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:153
Process finished with exit code 255
But Google is giving me no helpful results on what TestSuiteSorter might be and why it's suddenly started playing up right now.
Have run composer update, no news there.
I did upgrade Wordpress and Woocommerce, but rolling back to a commit before that happened (one where tests were green) doesn't help; it just gives me a slightly different error message about TestSuiteSorter.
Warning: include(/Users/piersb/Development/Den/dezeenjobs/_project/vendor/composer/../phpunit/phpunit/src/Runner/TestSuiteSorter.php): failed to open stream: No such file or directory in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/composer/ClassLoader.php on line 444
Does anyone have any leads?
New information: The commit that introduces the problem is when I switch from installing phpunit via the command line to installing it via composer. Checking the composer.json file, it looks like the version of phpunit being pulled in is coming in via a WP_Mock dependency.
The TestSuiteSorter class is being called by this version, but the file doesn't appear to exist.
In the end I updated my composer file requirements to this
{
"require": {
"intervention/image": "^2.3",
"10up/wp_mock": "0.3.0",
"phpunit/phpunit": "^7.2" // this is the new line
}
}
then deleted my vendor directory and ran composer install and composer update.
Everything is now working. Huzzah!

PHPUNIT gives COLOR_AUTO undefined class constant

Fatal error: Undefined class constant 'COLOR_AUTO' in C:\xampp\htdocs\zend-doctrine\vendor\phpunit\phpunit\src\Util\Configuration.php on line 584
Call Stack:
0.0018 209368 1. {main}() C:\Users\Bram\AppData\Local\Temp\ide-phpunit.php:0
0.0342 768592 2. IDE_Base_PHPUnit_TextUI_Command::main()
C:\Users\Bram\AppData\Local\Temp\ide-phpunit.php:500
0.0342 771992 3. PHPUnit_TextUI_Command->run()
C:\Users\Bram\AppData\Local\Temp\ide-phpunit.php:243
0.0342 772048 4. IDE_Base_PHPUnit_TextUI_Command->handleArguments()
C:\xampp\php\pear\PHPUnit\TextUI\Command.php:138
0.0342 773256 5. PHPUnit_TextUI_Command->handleArguments()
C:\Users\Bram\AppData\Local\Temp\ide-phpunit.php:248
0.2740 2873064 6. PHPUnit_Util_Configuration->getPHPUnitConfiguration()
C:\xampp\php\pear\PHPUnit\TextUI\Command.php:601
I ran into this error because the phpunit version installed globally on my system (9) was newer than the version in my project (6). I solved this by running PHP unit from the vendor directory as mentioned in this github issue.
Check where is COLOR_AUTO class file and include it in Configuration.php file
It was generated by an old version of PHPSTORM that i was using, bought a new version and it works.

Error when running a PHPUnit test

I get an error when I try to run a test in PHPUnit. Even if I type phpunit by itself, I still get an error. It works fine when I call it outside the Bootstrap folder.
Configuration read from /home/milen/Documents/codific/icho/module/Application/tests/phpunit.xml
PHP Fatal error: Call to a member function getId() on a non-object in /home/milen/Documents/codific/icho/module/Application/tests/ApplicationTest/Controller/PoCourseTest.php on line 268
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:426
PHP 6. PHPUnit_Extensions_SeleniumTestCase->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestSuite.php:699
PHP 7. PHPUnit_Framework_TestCase->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumTestCase.php:648
PHP 8. PHPUnit_Framework_TestResult->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestCase.php:760
PHP 9. PHPUnit_Framework_TestCase->runBare() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestResult.php:686
PHP 10. PoCourseTest->tearDown() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestCase.php:852
I tried reinstalling it, no luck.
I usually see an error along these lines when I have defined a bootstap.php file to run for PHPUnit which gets specified in the phpunit.xml file. With this setup, you need to be careful from where you run your tests so that the bootstrap file is run properly. This isn't a problem of PHPUnit per se, but a side effect from the phpunit.xml file.
This would appear to be the case because you stated that when you are not in the folder called "Bootstrap" (what / where ever that is), PHPUnit works fine. But without more information aside from the error dump this would be difficult to ascertain.
I think this question could be fixed with this answer.
I don't think its a problem with configuration, but rather a code execution in the setUp and tearDown method.

Symfony 2 doctrine fixtures load

I have a problem with
C:\wamp\bin\php\php5.5.12>php c:\wamp\www\symfony\app\console doctrine:fixtures:
load
Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found in
C:\wamp\www\Symfony\app\AppKernel.php on line 17
Call Stack:
0.0000 234000 1. {main}() C:\wamp\www\Symfony\app\console:0
0.0650 3390144 2. Symfony\Component\Console\Application->run() C:\wamp\
www\Symfony\app\console:27
0.0770 3622600 3. Symfony\Bundle\FrameworkBundle\Console\Application->d
oRun() C:\wamp\www\Symfony\vendor\symfony\symfony\src\Symfony\Component\Console\
Application.php:124
0.0770 3622824 4. Symfony\Component\HttpKernel\Kernel->boot() C:\wamp\w
ww\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\App
lication.php:70
0.0770 3623104 5. Symfony\Component\HttpKernel\Kernel->initializeBundle
s() C:\wamp\www\Symfony\app\bootstrap.php.cache:2303
0.0770 3623512 6. AppKernel->registerBundles() C:\wamp\www\Symfony\app\
bootstrap.php.cache:2473
Line 17 in AppKernel is correct and the file DoctrineBundle exist where it should be.
Anyone knows what is the reason of error?
The Error is clear. You add doctrine bundle to appKernel, but you don't install it (or bad install it ).
This happens when you add to AppKernel the requested namespace bundle (Doctrine\Bundle\DoctrineBundle\DoctrineBundle) before composer ends the installation command.
Try to delete line 17 in the AppKernel, then a composer update and after composer updated your vendors, replace the line 17 as it was

PhpStorm 7.1.3, XDebug 2.2.3, Symfony 2.4 - WebTestCase not found

I'm getting the following error when attempting to run my own Symfony unit tests in PhpStorm:
/usr/bin/php /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php
PHP Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php on line 8
PHP Stack trace:
PHP 1. {main}() /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php:0
Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php on line 8
Call Stack:
0.0002 234112 1. {main}() /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php:0
Process finished with exit code 255
Some research has informed me that I may have to point PhpStorm/Xdebug to Symfony's bootstrap and/or test suite XML file, but I'm not sure how to do that in PhpStorm. Nothing is jumping out at me in the various config screens. Please help.
Although I'm using IntelliJ IDEA, the configuration is the same, so:
Settings -> PHP -> PHPUnit - there are inputs for bootstrap and config

Resources