ZS 7.0.1 and PHPUnit

General discussion on Zend Studio
Posts: 7
Joined: Wed Sep 30, 2009 3:37 am

Re: ZS 7.0.1 and PHPUnit

Post by majelbstoat » Thu Dec 03, 2009 3:08 am

I've had major problems with running PHPUnit tests inside ZF, despite the fact that they work on the command-line. I couldn't even get the sample Guestbook application to test properly...


Adding the PHPUnit path doesn't solve the issue.

Posts: 1
Joined: Mon Jan 04, 2010 3:14 pm

Re: ZS 7.0.1 and PHPUnit

Post by mbuehler99 » Mon Jan 04, 2010 3:15 pm

Same issue in ZS 7.1 for Mac. However, it works fine for me on a Windows XP virtual machine installation.

Posts: 1
Joined: Tue Jan 12, 2010 2:24 pm

Re: ZS 7.0.1 and PHPUnit

Post by mvanduijn » Tue Jan 12, 2010 2:27 pm


having no class etc show up when trying to run a PHPUnit Test can be solved by changing the 'order' in the include-path. To solve the problem goto your projects properties -> PHP Inlcude path, tab 'order' and put the inlcude path for Unit test before the project path.
Now classes how up fine.


Posts: 1
Joined: Sun Apr 04, 2010 5:24 pm

Re: ZS 7.0.1 and PHPUnit

Post by xiayibin » Sun Apr 04, 2010 5:36 pm

Debug or run in zend stutio, there are three choice. See menu Run->Run As/Debug As. In the first time debug or run in zend stutio, it pops up a dialog and you can choose one. But I don't know from when, the default choice changes to "PHPUnit Test", then the "Unable to run PHPUnit session" error occurs. Select other choice can avoid the error.

Posts: 1
Joined: Thu Apr 08, 2010 5:47 pm

Re: ZS 7.0.1 and PHPUnit

Post by ksmcgloin » Thu Apr 08, 2010 5:49 pm

I had the exact same problem.
I resolved it by right clicking on my project, include path, configure include path, then choose Add Library, select PHPUnit 3.x, Next and Finish.

Posts: 2
Joined: Thu Apr 29, 2010 9:02 am

Re: ZS 7.0.1 and PHPUnit

Post by originalone » Mon Sep 06, 2010 6:21 am

The problem only appears when you use PHP 5.3 settings in ZS 7.2.0. When you use PHP 5.1/5.2 settings, everything works fine.

Posts: 1
Joined: Mon Sep 13, 2010 7:03 pm

Re: ZS 7.0.1 and PHPUnit

Post by adercley » Mon Sep 13, 2010 7:06 pm

Hello everybody,

I was facing the same problem here in my Zend Studio. Although I was trying to run a Flex application, I was getting the same error message than you guys.

The solution I found was: go to menu RUN -> RUN AS -> an choose the correct option other than PHPUnit Test.

Good luck.



Posts: 1
Joined: Wed Oct 13, 2010 12:50 pm

Re: ZS 7.0.1 and PHPUnit

Post by cschiavo_zend » Wed Oct 13, 2010 1:03 pm

I had this problem in a Zend Framework project and it drove me nuts for a long time. Finally I noticed that it was possible to run the test case/class if I moved the file into a different folder, in this case "application". A fresh new project didn't exhibit the same problem: the testing class could be placed anywhere. Then, a fresh new Zend Framework project behaved similarly.

Finally, I examined the differences between my original project and the test ones: the .buildpath settings were different. As it turns out the PHPUnit test cases won't run unless the file is under one of the build paths. I replaced:
<buildpathentry kind="src" path="application" />
<buildpathentry kind="src" path="" />

and the problem was solved. Now, why that results in the useless error message "Unable to run PHPUnit session. Only PHPUnit classes can be run as PHPUnit tests." is another mystery, but fortunately it's one I don't have to solve.

Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

Re: ZS 7.0.1 and PHPUnit

Post by mmmshuddup » Sun Oct 21, 2012 11:52 am

Just to confirm, this issue still exists. I am currently running Zend Studio 9.0.4 in a project with PHP 5.3 settings. Same problem, "no tests found in Module/tests/DualNavigation.php".

Posts: 1
Joined: Fri Nov 16, 2012 11:49 am

Re: ZS 7.0.1 and PHPUnit

Post by prys » Fri Nov 16, 2012 11:56 am

my problem is. if i run my testsuite everything works correctly.
if i run a single test on a single testfile in the same testsuite, then sometimes only one test is executed. if i delete this test, then i get the message "no tests found", although there are multiple other tests in that testclass.
if i run my testsuite again, everything works fine.

i am using ZS 9.0.3

Post Reply