Reputation:
I want to make unit tests of a web crawling library with PHPUnit.
To do so, I need to set up a temporary web server in local to test properly.
I can do this:
exec('php -S 127.0.0.1:8888');
This looks ugly. And how can I even stop it?
So, is there a good way to start a temporary local web server (just for some tests) and then stop it? Knowing that, I want to do it in PHP, so I can just roll the tests out in every environment without worrying about launching a temporary server by hand every time.
Upvotes: 0
Views: 108
Reputation: 8326
Have a look at what Symfony does with its server:run command (source).
Upvotes: 0