Running PHPUnit from PHP instead of runner
Moderator: General Moderators
Running PHPUnit from PHP instead of runner
Using PHPUnit 3.6 how to you run a php test suite using PHP instead of the test runner and get output like the test runner?
Re: Running PHPUnit from PHP instead of runner
Do you mean through the web browser? Because the test runner is a PHP script....
Just make file whatever.php
You can use the exec() & passthru() commands to run command line commands, like the PHP test runner, and send it's output to the browser. There's also html based reports PHPunit can dump, as well as phpundercontrol which has it's own reporting styles
Just make file whatever.php
You can use the exec() & passthru() commands to run command line commands, like the PHP test runner, and send it's output to the browser. There's also html based reports PHPunit can dump, as well as phpundercontrol which has it's own reporting styles
Re: Running PHPUnit from PHP instead of runner
Thanks but i don't want to run system commands because PHP takes 6 seconds to load.if i run it as a PHP script using the PHPUnit API and then run that through apache then PHP is already loaded and will run immediately.
Running a system command is exactly the same as running on the command line and will take 6 seconds just to load.
You used to be able to run it very easily by getting the result of a test suite and then just doring a $result->toString() or $result->toHtml() but PHPUnit's Framework doesn't provide that so not sure how to get the output easily.
Running a system command is exactly the same as running on the command line and will take 6 seconds just to load.
You used to be able to run it very easily by getting the result of a test suite and then just doring a $result->toString() or $result->toHtml() but PHPUnit's Framework doesn't provide that so not sure how to get the output easily.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Running PHPUnit from PHP instead of runner
Your PHP takes 6 seconds to load? Mine loads immediately from CLI.jadent wrote:Thanks but i don't want to run system commands because PHP takes 6 seconds to load.if i run it as a PHP script using the PHPUnit API and then run that through apache then PHP is already loaded and will run immediately.
Running a system command is exactly the same as running on the command line and will take 6 seconds just to load.
You used to be able to run it very easily by getting the result of a test suite and then just doring a $result->toString() or $result->toHtml() but PHPUnit's Framework doesn't provide that so not sure how to get the output easily.
Re: Running PHPUnit from PHP instead of runner
there are numerous modules that take a while to load. any help on the PHPUnit script?
Re: Running PHPUnit from PHP instead of runner
PHPunit can take a few moments to analyze all your test files before it begins to execute tests. This hit comes only when running the entire suite at once, when I run only certain tests at once theres much less lag. I have 1,000+ tests with an average of 5 tests per class.
Re: Running PHPUnit from PHP instead of runner
If I understand your problem right, you may create a custom php.ini for your CLI tests.
It will load only the necessary modules thus your PHP CLI "loading" will be much faster:
It will load only the necessary modules thus your PHP CLI "loading" will be much faster:
Code: Select all
php -c /path/to/my-simple/php.ini `which phpunit` arguments.....
There are 10 types of people in this world, those who understand binary and those who don't