PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 30, 2022

[FIXED] How can I get IDE autocomplete for PHPUnit if I installed from source?

 August 30, 2022     pear, php, phpstorm, phpunit     No comments   

Issue

I know it seems like a duplicate, but my problem is different:

Since I installed PHP from source, some folders are not there. I installed PHPUnit the usual way using pear.

Normally I would add /usr/share/php to the include path of the IDE or project and be done. But that folder doesn't exist.

$ updatedb
$ locate phpunit
/usr/local/bin/phpunit
/usr/local/lib/php/.channels/pear.phpunit.de.reg
/usr/local/lib/php/.channels/.alias/phpunit.txt
/usr/local/lib/php/.registry/.channel.pear.phpunit.de
/usr/local/lib/php/.registry/.channel.pear.phpunit.de/phpunit.reg

$ locate PHPUnit
/usr/local/lib/php/doc/PHPUnit
/usr/local/lib/php/doc/PHPUnit/LICENSE
/usr/local/lib/php/doc/PHPUnit/README.md

I tried including /usr/local/lib/php, but I still get "undefined class PHPUnit_Framework_TestCase"

Note that php and phpunit work fine, I only need help with IDE autocompletion.

What can I do?


Solution

As of PHPUnit v4 PEAR distribution now contains PHAR version instead of lots of individual files. And there is one file (phpunit) instead of launcher + php files (on installation phpunit.phar gets renamed into phpunit).

Because it now has no .phar extension, IDE will not be able to recognize it accordingly.

The easiest option is to download actual PHAR version of PHPUnit and place in anywhere in your project (e.g. inside vendors folder).



Answered By - LazyOne
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing