PHPStorm use PHPUnit with extends TestCase and not PHPUnit_Framework_Testcase

hy

i create PHPUnit tests, and i extend this test with "extends TestCase".

i mark my folders as test and run on the folder the tests. all is working fine.

but i cant run the test on a single file. there are run php self and not phpunit test.

only i extends my test-class with "PHPUnit_Framework_TestCase" then is run as test.
But when i extends my class with PHPUnit_Framework_TestCase, i bekom this exeption:

Class 'PHPUnit\Framework\PHPUnit_Framework_TestCase' not found

The Tests are running on my Ubuntu-Server as remote. there i install phpunit with composer.

can i configure PHPStorme so, that he accept a file with TestCase extends as PHPUnit Testfiles?

 

Great Andy

0
1 comment

Hi there,

Could you bring some screenshots .. because it's very confusing and unclear (for me at very least) on what you need here.

But generally speaking (based on my understanding):

1) "Settings/Preferences | Editor | File and Code Templates" -- you can adjust "PHPUnit Test" template to suit your needs.

2) "PHPUnit\Framework\PHPUnit_Framework_TestCase" -- this one does not make much sense to me -- feels like PHPUnit v6 (namespaced) and v5-4-3 (older version, Zend style named classes) are mixed together (possibly it's the actual reason/error?).

But in any case: PHPUnit v6 support is added in 2017.1 EAP builds; for latest stable 2016.3.2 you have to edit generated code/template yourself.

2

Please sign in to leave a comment.