I am using the Symfony3 plugin in PhpStorm. My PHP Interpreter is 7.0.18. I have PHPUnit 6.3.0 configured in PhpStorm by having the .phar
file in the root directory of my project.
Unit test work like a charm inside the IDE however performing any operation on the server (like bin/console server:start
) triggers the following messages:
PHP Fatal error: Class 'PHPUnitFrameworkTestCase' not found in /1tb/programming/PhpstormProjects/binary_search/src/AppBundle/Search/BinarySearchTest.php on line 13
PHP Fatal error: Class 'PHPUnitFrameworkTestCase' not found in /1tb/programming/PhpstormProjects/binary_search/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/TestCase.php on line 17
BinarySearchTest.php:
<?php
namespace AppBundleSearch;
use PHPUnitFrameworkTestCase;
class BinarySearchTest extends TestCase
{
}
TestCase.php:
<?php
namespace SymfonyBundleFrameworkBundleTests;
use PHPUnitFrameworkTestCase as PHPUnitTestCase;
class TestCase extends PHPUnitTestCase
{
}
I have read many posts with problems similar but none of them describe the problem the way I do. Then I tried running PHPUnit with phpunit .
in the root directory of the folder with this error:
PHP Fatal error: Class 'DoctrineTestsCommonCacheCacheTest' not found in /1tb/programming/PhpstormProjects/binary_search/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php on line 10
It seems whatever I do I just run into more errors. I only just got started with Symfony and read a bit of the documentation but I can't get a grip on this thing, I have been at it for two days. Any suggestions for me?
Installation of PHPUnit via composer worked. It turns out my composer installation went wrong in some way. After composer was successfully installed, I let it handle installing PHPUnit. After that it just worked. Tests work fine in the IDE and the server is responsive again. Thanks LazyOne.