PHPUnit won't run in test scope 'directory'

When I run phpunit with test scope class it works fine.

But when I switch to 'directory', and run it, the result is:

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "D:\Devsites\sites180\learnit\prod\tests.php" nor "D:\Devsites\sites180\learnit\prod\tests.php" could be opened.' in D:\Devsites\run\xampp180beta3\xampp\php\pear\PHPUnit\Util\Skeleton\Test.php on line 100
So it tries to run the file 'tests.php' instead of the directory tests, so it seems.

Is this a common problem (I can't find it here)? Have run out of configuration options without writing a special xml.

Comment actions Permalink

Hi Henk,

Please provide a screenshot of your PHPUnit Run Configuration. Maybe you forgot to change the target field (should be folder name instead of specific file name, since you have changed the scope from Class to a Folder).

Comment actions Permalink

Hello Andriy

I have enclosed a screenshot.

The behaviour has become somewhat strange: Now only the first test is run when I start from a directory...

Apart from that, I notice two small triangles in the project toolwindow on the icon of the file InfosheetmodelTagsTest.php.

One is red, the other green. I cannnot find the meaning of them (btw, i have also git & github installed).
They are also on this screenshot.

Apart from this everything works fine.

Comment actions Permalink

Hi Henk,

Those triangles mean that PhpStorm recognise it as PHPUnit test file.

If you do not use any custom test case handler/loader, then it is required to have file names that have tests in it to be ended with Test in the end (when testing all files in directory). In your case -- InfosheetmodelTagsTest.php is correct file name while 2 others are not (InfosheetmodelTest1.php & InfosheetmodelTest2.php). The same requirement may be applied to test classes names (not 100% sure on this one).

If the aforementioned is not that reason (which should be -- I'm positive on that) then I can't say for sure what else may be wrong here (missing bootstrap.php ... or some error in test file itself -- unsure). Is it possible for you to provide those test files here? -- that would be great. If not those particular files .. then maybe some strip-down version of them (together with run configurations) in separate project that can be used to check what may be wrong?

Comment actions Permalink

You are completely right. I changed the names somewhat carelessly... :8}

This did the trick.

Thanx, Henk

Message was edited by: Henk R :   Forgot to mark this thread as question.. So cannot mark it as answered.. Shoul read manuals more carefully..


Please sign in to leave a comment.