Reputation: 4176
After spending several hours today searching and seeing several people having the same issue, I thought I turn to SO.
I run a WAMP stack; I have successfully installed PEAR and PHPUnit 3.6 using PEAR. I'm able to run phpunit over command line.
My WAMP folder is located at C:\wamp - I have several www folders - for sake of example let's say I have an MVC application located at C:\www\myproject.
/myproject
/application
/controllers
/models
/modules
/forum
/controllers
/models
/tests
/views
/views
/public_html
/tests
I'd like to know where PHPUnit is looking when I run something like
phpunit ArrayTest
Any help greatly appreciated, Thanks
Upvotes: 0
Views: 1244
Reputation: 38961
phpunit --help
PHPUnit 3.6.9 by Sebastian Bergmann.
Usage: phpunit [switches] UnitTest [UnitTest.php]
phpunit [switches] <directory>
This means you have two options:
If you want to execute one test you can say:
phpunit myTest /path/to/my/test/php
or you can say
phpunit /path/to/my/projects/tests
and it will recursively scan the directory for all files ending in Test.php and execute all tests in those folders.
This is outlined in the phpunit documentation regard test suite organisation
and in the help output and to be honest with you: I've never seen anyone having an issue with that so far :)
What is usually done is that people put a phpunit.xml.dist
file in their project root.
In that file you can specify everything regard test location, test suite bootstrap and other configuration options. Check the xml file docs
This allows you to just type phpunit
and the tests will run.
Upvotes: 7
Reputation: 24549
It is looking for your /tests in the current directory. Change (cd ..) to the directory containing your project and run phpunit.
Upvotes: -2