php - how to install phpUnittest?
I am trying to write a Unit Test to test my YII application using phpunitest. I installed it and when I try to run my test I use shell command:
phpunit --bootstrap bootstrap.php DbTest.php
then I get this error:
PHPUnit 4.6.6 by Sebastian Bergmann and contributors. Cannot open file "bootstrap.php".
how Can I fix this?
This problem can be easily fixed.)
You should write correct path to your bootstrap.php. That's all.)
You can run
phpunit --bootstrap boostrap.php SMTest.phponly if your boostrap.php lies in same directory that SMTest.php.
Or you can write absolute paths:
phpunit --bootstrap /www/tests/config/boostrap.php /www/tests/unit/SMTest.php
and invoke this command from any place.
your bootstrap goes in your phpunit.xml config file.
So it would look something like:
and when you run your test you run it with
For reference: The phpunit.xml config section in the manual.