PHPUnit error "undefined index : HTTP_HOST"
netbeans, php, phpunit
Solution
In your `phpunit.xml` file, you can set server variables. Add the `php` element under the `phpunit` root:
<phpunit>
<php>
<server name='HTTP_HOST' value='http://localhost' />
</php>
</phpunit>
See the docs for more information.
Problem
I have declared a HTTP_HOST as shown below. ``` public function testReadUser() { $_SERVER['HTTP_HOST'] = "x.y"; . . . } ``` Inspite of this, phpunit gives undefined index error. Why is it?