I have PHPStorm 8.0.1.
PHPUnit is installed via PHAR archive like:
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/bin/phpunit
PHPUnit works via cli:
user#pc:/usr/bin$ cd ~
user#pc:~$ phpunit --version
PHPUnit 4.3.5 by Sebastian Bergmann.
I followed the instructions from JetBrains website https://www.jetbrains.com/phpstorm/webhelp/enabling-phpunit-support.html#d298258e897
In PHPStorm File->Settings tab PHP/PHPUnit
the radio button Path to phpunit.phar is checked
and value is set to /usr/bin/phpunit
I have a file with a test defined like:
class MyTest extends PHPUnit_Framework_TestCase {
...
At this point PHPStorm marks Undefined class PHPUnit_Framework_TestCase
I've restarted PHPStorm and Computer, but still have the same problem.
I've also tried adding /usr/bin to include path (right click on external libraries in project view, and choose option Configure PHP include paths) without success.
Here's the config for PHPStorm Settings, tab PHP (if it matters):
PHP Language level: 5.5 (finally, generators, etc.)
Interpreter: PHP 5.5 (5.5.9-1ubuntu4.5)
Include path is empty
In order to have a PHAR archive indexed by the IDE it has to have a .phar extension (that's a requirement).
The easiest solution is to place phpunit.phar somewhere in your project (usually it would be PROJECT_ROOT/vendor/ folder).
If having local copy inside the project folder is not desired (for whatever reason; although Composer and other similar kind of tools (bower/npm/etc) are primarily aimed at keeping dependency stuff/packages locally), you may use symbolic links:
either create a symbolic link to that file locally (e.g. PROJECT_ROOT/phpunit.phar --> /usr/bin/phpunit)
or place a full copy (or such symbolic link) in a separate folder outside of the project and then reference it via PhpStorm's Settings | PHP | Include Paths functionality.
The above fix by Calin worked for me too on PhpStorm 2019.1.1, so I'll post it as an answer for easier visibility:
Try right clicking on the .phar and clicking "Exclude phar from project", then clicking "Include phar into project" to refresh it.
In my case, both the .phar file and my .idea folder were pulled from a git commit. I guess PhpStorm didnt realise that the file needed reimporting.
I noticed even though PHP itself can find and run phar that is in its include path, PHPStorm having trouble finding and parsing them.
LazyOne's explanation is correct, however, I didn't need to put it in project folder to be recognized, you can put them in any path as long as its path is introduced to IDE. In my case, I put all phar files in PHP folder, so I just needed to add PHP folder to Include Path list in IDE
Include Path for PHP is under Settings -> Language & Frameworks -> PHP screen (that tiny + at the bottom of screen).
Related
I am developing a web application in Java on my mac.
The web application will run on tomcat.
I have installed tomcat in /usr/local/apache-tomcat.
When I try to set the tomcat runtime in Server->Runtime Environments, I am not able to see the folder /usr/local. how do I get eclipse to see the /usr/local/apache-tomcat directory?
I am able to see /usr/local when using the Go to Folder option in Finder.
I had similar problem with loading external jar files in /usr/local/ for Eclipse on Mac
The way i resolved this was to create a soft-link using ln -s to the folder in /usr/local to a visible folder and then loaded the jars.
ln -s source visible_location/link
Works for me.
I just got a similar problem, and the workaround i found is to copy/paste the path of your tomcat base directory, and it works fine:
Go to your tomcat base directory
pwd to get the path and copy it
Go to eclipse -> preferences -> servers -> runtime environments -> add button -> select apache tomcat version -> then next
At this step, instead of browsing, you can simply paste the copied path in the Tomcat installation directory field!
et voilà
My guess is that you have your finder settings that hide hidden folders. It is possible to show them by following the instructions in this article.
The easiest way to do this is to type the following in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
If you type out the full name of the installation folder instead of using the finder, does it work?
You can easily control hidden files writing this in bash_profile
alias hideOn='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hideOff='defaults write com.apple.finder AppleShowAllFiles FALSE'
alias kFinder='killAll Finder'
alias hOn='hideOn && kFinder'
alias hOff='hideOff && kFinder'
Then, reopen your terminal and write hOn. At root folder you will see hidden /usr. Just put it in your finder sidebar. Then write hOff and you will stop seeing the hidden files, but /usr will be always there at finder.
I have Static Web project in Eclipse and using Http Preview server for development. I want to use root relative path in my resources (e.g. /css/style.css) but I can't figure out how to configure that server to work. There always needs to be context root in path (e.g. http://localhost:8080/myapp). Context root can't be configured as empty. Is there any option I'm missing?
I have found a workaround for this problem if you are working on a Unix variant. It relies on symbolic links, so it probably cannot be made to work on Windows. I claim no points for elegance, but it does seem to work for me on Ubuntu.
First, you create a new static web project in Eclipse that will contain a link to the resource directory. In this case, you can call the project css. Alternatively, give it a descriptive name, and change the context root to css using the project properties dialog.
In a terminal window, change to the project directory for the newly created project. Probably something like ~/workspace/css/. Then replace the WebContent directory with an appropriate symlink:
cd ~/workspace/css
rmdir WebContent
ln -s ../myproject/WebContent/css WebContent
Now return to Eclipse and refresh the css project. You should now see all of your css files in the project explorer.
Run the css project and the original project on the HTTP preview server.
You will have to repeat this process for each of the top-level resource directories.
I'm trying to use SASS in Netbeans 8.0.1. I have Ruby and SASS set up correctly based upon the feedback from ruby -v.
I have a web application set up with css and scss folders under Project\Web Pages\resources.
My input and output are set to /scss and /css respectively and I have checked 'Compile Sass File on Save'. I have created a styles.scss file and added some SASS/CSS.
When I save the styles.scss file, is it supposed to generate a styles.css? Nothing happens when I save or compile the project.
Has anyone run into any similar problems or have suggestions on how to debug this problem?
Thanks in advance!
Installing SASS on Windows10, Ruby2.2.3, Netbeans8
Download SASS for Windows - RubyInstaller.org
Install Ruby like:
Search windows for CMD (Command Prompt) and start it.
Access Ruby's bin folder using cd \Ruby\bin (Hit Enter)
Install sass using the command gem install sass (Hit Enter to install)
Wait for the installation to finish
In Netbeans open
Options → Tools → Miscellaneous (HTML/JS in v8.1+) → CSS Preprocessors tab
Enter the path to the installed sass.bat C:\Ruby\bin\sass.bat than click Install Sass.
Confirm your changes with Apply / OK
Use an existing one or Create a New Project (HTML5, PHP, whatever...).
After the project is created open the Projects window.
Right-Click your project and choose > Properties.
From the Project Properties popup select CSS Preprocessors.
Select the Compile SASS Files on Save.
(If you want the compiler to automatically minimize your .css result file, use --style compressed under the Compiler Options)
You can see from the image above that the compiler uses two default Input(watchable)/Output(compiled destionation) folders paths.
Create the scss folder (an optionally the css folder) in your project as well.
You're done!
As soon you create a new .scss file or you save it Netbeans will automatically compile the file to .css in the /css folder.
Yes, when you save the file, the css should be created/updated. I think you have wrong mapping for the input/output directories. The paths need to be relative to site root/web root. I don't know for sure what your project is (HTML5 or PHP or Java Web or other?), but if you have Java Web project, then the paths need to be
resources/scss -> resources/css
Salam guys, the below image form my (Command Prompt with Ruby) says that:
"Ruby Sass has reached end-of-life and should no longer be used"
For modern SASS and Netbeans we can just use https://github.com/sass/dart-sass/releases/tag/1.56.1 and install it in our PATH.
The release has the sass.bat file we need (as Roko C. Buljan pointed in his tutorial for Ruby).
There's not need to install Ruby and any other environment.
I applied this on Netbeans 15
How can I get NetBeans to provide code-completion for PHPUnit classes and methods?
I have already tried downloading from the PHPUnit GitHub project, but I didn't understand why the directory is different from what's mentioned on the Selenium documentation. I am looking example for the /test/PHPUnit/Extensions/SeleniumTestCase.php file.
I have already installed PHPUnit from PEAR, but what I need now is the complete PHPUnit file so I can include it in my IDE (in this case NetBeans).
Add the PHPUnit directory to NetBeans's PHP global include path. This will provide code completion in NetBeans for all projects.
Open Tools : Options
Switch to the PHP tab
Click Add Folder... next to the Global Include Path box
Enter /usr/share/php/PHPUnit or navigate to where PEAR installed PHPUnit's source files
Click Open
Click OK
Update: The file defining PHPUnit_Extensions_SeleniumTestCase is placed in the same directory as PHPUnit when you install PHPUnit Selenium.
For example, PHPUnit_Framework_TestCase is stored in
/usr/share/php/PHPUnit/Framework/TestCase.php
The Selenium test case is stored in
/usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php
So by placing /usr/share/php/PHPUnit into the NetBeans include path, you pick up both. You have to install the extension first, of course.
pear install phpunit/PHPUnit_Selenium
Moving away from PEAR...(I'd even uninstall the PEAR version to avoid conflicts first).
Download PHPUnit with sources
https://github.com/sebastianbergmann/phpunit and extract somewhere
semi-permanent /your-install-path
Add /your-install-path/phpunit to your PATHs
In Netbeans options (Tools > Options on Windows, Netbeans > Preferences on OS X), go to PHP tab..
a. Under the General tab, Add Folder... and select the /your-install-path/src/ folder - this will make the auto complete work
b. Go to Frameworks & Tools tab, PHPUnit, select the /your-install-path/phpunit and /your-install-path/phpunit-skelgen respectively - this will make PHPUnit tool work within Netbeans
In your project settings, right click project name > Settings, Testing category, enable PHPUnit. Optionally go to the Testing > PHPUnit settings panel and make adjustments for your project.
Edit:
When I followed the instructions above, the output window told me I needed to install dependencies using "composer install." These additional steps were needed on my machine (running Netbeans 8.2 on Windows 7).
Download Composer and install: https://getcomposer.org/doc/00-intro.md
Modify your-install-path/composer.json by adding the version number between the "description" and "type" keywords like so:
"description": "The PHP Unit Testing framework.",
"version": "5.7.8",
"type": "library",
Using the command line, type the following (this is a windows machine, for mac or lunix, it should be a little different):
cd your-install-path
composer install
I have a PHP script to run. If I run it from the command line, it works fine (include path is set correctly).
If I want to run it inside Eclipse (Run as script), then the PHP include path of my php.ini is replaced by Eclipse, with all the libraries I've added to the project.
I've configured my PHP executable in Eclipse. I've set the correct PHP executable file, and I selected my php.ini file too (the right one, I've checked). But it is ignored...
Edit : this is an Eclipse bug :
https://bugs.eclipse.org/bugs/process_bug.cgi
Wouldn't manually re-adding the old paths using
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
in the first line of the script you're running work?
Could you add the current php include path as a linked folder within your project, in order to reference that linked directory in the PHP include path?
alt text http://files.zend.com/help/PDT/include_path_properties.png
That way, even if your path is replaced, it will be replaced by:
your path
all the other librairies
This is a bug of Eclipse, 3 bugs have been filled about it but none of them got fixed.
No solution without modifying your PHP files.
https://bugs.eclipse.org/bugs/process_bug.cgi
In Eclipse for PHP Cli Applications
1) Click on Project Properties
2) Click on Include Path
3) Add external folder and/or Source and/or Libraries
After doing such I was able able to run my programs. If I didn't do the above I was having to use the function
set_include_path(get_include_path() . PATH_SEPARATOR . "c:\PHP\PEAR"); etc...
For PHP Web applications I wasn't having issue because I put my include_path var in the Apache2 vhosts file along with my configuration.