PHP unit testing problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryogesh1508
Forum Newbie
Posts: 1
Joined: Mon Sep 06, 2010 5:09 am

PHP unit testing problem

Post by ryogesh1508 »

pls help me..
i am new to PHP unit testing concept. i just wrote a PHP unit test case for a login module in ZEND frame work. for that we have to see the result via command promt. but in some places of zend frame work we are using '$_SERVER['HTTP_HOST']' to get server host name but it can get only by hitting via browser so while am hitting via command promt it will give error message lik this(given below)

Generating code coverage report, this may take a moment.PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 147

Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 147
PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 197

Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 197
PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/library/Zaah/Controller/Plugin/Ssl.php on line 79

Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/library/Zaah/Controller/Plugin/Ssl.php on line 79

i cant give server host name at all the places. so please help me how to solve this problem....

thanks
Yogesh
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP unit testing problem

Post by Christopher »

Maybe set the host name in the configuration and pass it in via the Config object. Then you can set it manually when testing.
(#10850)
Post Reply