How to setup PHPUnit for Intellij IDEA 13.1 on Ubuntu 13.10? - intellij-idea

I'm developing a PHP5 program using IDEA 13.1. Of course I want to cover my code using some Unit tests.
I installed phpunit via aptitude and upgraded it to 4.0.11 using pear.
Somehow IDEA seems unable to detect the installed PHPUnit... The class PHPUnit_Framework_TestCase is marked as undefined. The documentation on https://www.jetbrains.com/idea/webhelp/enabling-phpunit-support.html wants me to include either the pear directory (which does not exist) or the phpunit.phar (which does not exist, either).
So far most things went smooth with IDEA so I'm surprised that something as fundamental as setting up PHPUnit does not work :-(

Ok, after some fiddling around I got to a working solution. I downloaded phpunit-lts.phar from phpunit.de and put it directly into the project (along with the other files... meh).
Do not use the most current version (4.0 as of 21st of march 2014) of PHPUnit! Versions beyond 3.7 (or 3.8, as it seems) are not supported by IDEA or PHPStorm. You will get
PHP Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /tmp/ide-phpunit.php on line 504
So do yourself a favor and stick to the LTS version for now.

Another solution:
Set
"phpunit/phpunit": "3.7"
in composer.json
and run
composer update
Then the issue will be resolved.

Related

Properly set up Java 9 as SDK in Intellij IDEA on Linux due to new folder structure

Before you write me off, please consider that neither of these are answers to my question:
How to setup SDK in IntelliJ IDEA?
How do I change the IntelliJ IDEA default JDK?
In IntelliJ IDEA 2017.2.6, attempting to add JDK9 as an SDK passes but does not work as the classpaths end up empty. Steps to reproduce:
Open 'Add new SDK dialog'
(go to Project Settings > Project > Project SDK > New > JDK)
Select JDK 9
Passes, but if you look under SDK > JDK9 classpaths are empty and your code errors out due to base classes not being found. See image:
In IntelliJ IDEA 2017.3 EAP you get an error about JDK classes not being found. See images below:
Open 'Add new SDK dialog'
(go to Project Settings > Project > Project SDK > New > JDK)
Select JDK 9
Should pass, but produces error popup
Command line compilation of HelloWorld example with jdk9 works as expected.
EDIT: Found an almost-duplicate: Intellij IDEA 2017.2 can't add openjk 9 on Linux Mint 18. Key differences:
Linux version: they're using Mint 18, and I'm using Debian Stretch.
OpenJDK is the latest from the repo at the moment of writing: 9~b181-4~bpo9+1. Even though is the same version, it still does not work in my case.
EDIT: Another possible duplicate: intellij idea does not see java 9 standard classes
I did not understand the answer from the comments though. Tried setting different names for JDK (9 and 1.9) but it still did not show modules instead of classpaths and classpaths remained empty.
Current debian binary package openjdk-9-jre-headless 9~b181-4 contains incorrectly compiled lib/jrt-fs.jar file.
There are 2 filed issues separately on both idea youtrack and also ubuntu launchpad.
As it is indicated here:
Probable reason:
Classes in lib/jrt-fs.jar were compiled by Java 9 with options "-source 8"/"target 8". They should be compiled with "--release 8" option instead (or by Java 8)
A temporary workaround may be replacing /usr/lib/jvm/java-9-openjdk-amd64/lib/jrt-fs.jar with the one from Oracle JDK.
You may also try to recompile the openjdk-9 source using the advised option "--release 8".
Anyway I advice to vote up this issue on the above link to attract more attention by dev team.
Use Oracle Java instead of OpenJDK for now. You can pull that in through WebUpd8's repository.
sudo add-apt-repository ppa:webupd8team/java &&
sudo apt-get update &&
sudo apt-get install oracle-java9-installer
It doesn't look like this is going to work with OpenJDK, so if you want to play with the latest and greatest Java, this is going to be the way to do it for now. Otherwise, from what I've seen, you've done this correctly and once this gets actually fixed, it will work just fine.

Using WebKitGTK+ on Centos 5.8?

I'm trying to build an embedded simple web browser for an embedded device and I've decided to use WebKit / WebKitGTK+. However, our device uses a Linux environment somewhat based on CentOS 5.8. I haven't been able to find any RPMS or mention of support for WebKit / WebKitGTK+ for CentOS 5.8 while doing several web searches.
Does anybody know if it's possible to build an older version of WebKitGTK+ such as 1.2.6-2.el6_0 which works well on CentOS 6.3? Are any RPMS available for CentOS 5.8?
The goal here is to be able to run a relatively current, at least 1.2.6 version of WebKitGTk on CentOS 5.8
Note: I was able to sort everything out. Just took a long time compiling all of the dependencies in the correct order with the correct options. I was able to get WebKitGTK 1.6.0 running on Centos 5.8.
You shouldn't have any problems building an old version of webkit if you can install the older versions of libraries that it requires.
If you have older or newer versions of GTK+ etc installed than the old version of webkit requires it may need quite a bit of porting to compile.
I'm not aware of any RPMs that meet your requirements
Depending on the compilation options you should be able to compile the dependencies in an isolated directory. With each library you typically use the --prefix option to specify the destination. Then when compiling something that depends on that library, you typically have an option to specify where to look for that library - something like --with-libraryname=/path/to/library. You want to check ./configure --help of each thing you're compiling to get the correct options.
It'll be quite a bit of work, but you should be able to compile everything you need into an isolated directory without replacing anything on the system. I would highly recommend you avoid doing this in root to ensure you have the right options.

Can't uninstall GlassFish 3

Okay, so here is the deal:
I was trying to install the java jdk so i can work on an android project in eclipse on this computer, but there are just so many different installations of java its impossible, for me atleast, to figure out exactly which one i needed. so i went with "JDK 7u3 with Java EE". But this also installed this GlassFish stuff, which i have no idea what is or what it does, and when i was going through all the eclipse stuff i decided to just keep my other computer for work. so i removed eclipsed and the stuff needed for that, and i removed the java stuff, but then when i try to uninstall the GlassFish, it can't, and gives me the error:
"Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'."
I have now been trying for several hours, scouring the web to figure out some way of removing this, install all kinds of java stuff, removing it again, reinstalling, but nothing works. I don't really care what GlassFish is or what it does, i just want it, and all the java stuff gone for good.
How can i accomplish this?
under Microsoft Windows 7 (or others), use that command line :
uninstall.exe -j "%JAVA_HOME%"
You installed first jdk1.6 then uninstalled it. In this time, you install glassfish3 and glassfish wrote set AS_JAVA=C:\Program Files (x86)\Java\jdk1.6.0_x in its config file but you use now jdk1.7
Open C:\glassfishv3\glassfish\config\asenv.bat
Search 'set AS_JAVA'
Change its value to your current jdk path ( eg. C:\Progra¨1\Java\jdk1.7.xx )
Try to uninstall again.
You can run the uninstall specifying the jvm to use:
try this following command to uninstall
C:\glassfish3\uninstall.exe -j <java home dir>
as stated in the error message. it worked for me.
GlassFish is a Java EE application server developed in open source, so you can create server-side services that your android apps can consume. Of course, is sounds like you are not really interested in this :-)
The Java EE SDK install/uninstall instructions are here: http://java.sun.com/javaee/sdk/javaee6sdk_install.jsp
What you probably want to download, the Java 7 SDK (JDK 7) is here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Make sure you download the JDK (Java Developer Kit) and not the JRE (Java Runtime Environment).
Hope this helps.
These didn't work for me running java 1.6.0_24 in Windows 7:
I tried modifying the asenv.bat file that glassfish uses to find the jre to point to my jre.
I tried manually putting it in as in C:\glassfish3\uninstall.exe -j . This was per the official Oracle documentation.
The only thing that worked was to use the original path and move the bin and lib folders from my java installation to the directory that the error dialog
specified. Then the Glassfish uninstall started up and completed with no problems.
I was able to uninstall the glasshfish server by using the below command
uninstall.exe -javahome "%JAVA_HOME%"
Note: We need to set the JAVA_HOME in the environment variable and classpath variable

Multiple Xcode Installation

After a fresh install of Lion and Xcode 4.1 from the Mac App Store, I would like to install another version of Xcode alongside.
I heard that this perfectly safe to install it in another directory (considering the first to be on /Developer). The only thing to remember is that running xcodebuild would result in launching the last one installed.
But I have another issue while installing it, even f I changed the directory it clearly says that it will upgrade Xcode Toolset, System Tools and UNIX Development and that they can only be located is /Developer and for one installation per system, here is a screenshot :
So how to have another clean instance of Xcode and SDKs without screwing up the production one ?
Thanks a lot.
It doesn't seem to be possible to install the System Tools on both versions. I've never had success with that.
One thing to note, if you install an older version of xCode side-by-side with the latest version, the "Build Archive" function in the Organizer will not function. The only remedy I found was to remove both xCodes and reinstall the one I wanted to use for building the archive. It was a painful process.
Actually you can do this (or at least I seem to be able to). At times I have had three separate instances of XCode installed - an older XCode 3.x (which I've subsequently gotten rid of), an XCode 4 production, an XCode 5 beta; all in separate directories.
The key thing for me was calling the command line tool to tell which system is the "primary" xcode for the purposes of running xcodebuild, instruments, agvtool and a bunch of others: xcode-select -switch /Developer (just man xcode-select ftw).
So, I have a 4.0.2 build as primary now, and keep upgrading the iOS5 betas. I try them out, but when I want to cut a production build using 4.0.2, I ensure that my system knows that /Developer is current, switching it if I need to. FWIW, there is risk that the single-set-of-System-tools could be broken when you replace them with the latest set, but that's (so far) never hit me.
Also, for reference there is another discussion along similar lines here: Install xCode 3.2.3 w/ iPhone SDK 4, get "Base SDK missing", can't see other SDKs

Run NUnit on Mono?

Does anyone know if you can run NUnit on Mono? The reason I ask is because on the download page it says:
For some releases, we provide a zipped package for use under Mono.
However, the only release that actually has a separate mono release (judging by its label that says "mono:" and then shows the .zip) is the ancient 2.2. NUnit's most recent version is 2.4.8 so I would really rather not use that old of a version.
Can you use the recent version of NUnit on Mono? If not, is there anything I could do to get it to work? What exactly makes something Mono runnable?
Mono 2.4 will ship with NUnit 2.4.8, and has been in use by the Mono project for their tests for several months, so it should work pretty well.
Mono 2.4 preview: http://mono.ximian.com/monobuild/preview/download-preview/
To answer any other "Will x run on mono..." they've produced a tool called the Mono Migation Analyser.
It can be found here and will show you what methods (if any) mono is missing to run your application.