试图在我的Kohana 2.3.4安装上运行PHPUnit:
phpunit --colors --bootstrap=index.php ../../modules/phpunit/libraries/Tests.php
Run Code Online (Sandbox Code Playgroud)
在我的一个模块上出错:
<p><tt>modules/core/helpers/MY_url.php <strong>[118]:</strong></tt></p>
<p><code class="block">Undefined index: HTTP_HOST</code></p>
Run Code Online (Sandbox Code Playgroud)
我意识到这种情况正在发生,因为我要通过命令行,所以不会设置HTTP_HOST.如果没有在该模块中重写HTTP_HOST,有没有办法解决这个问题?我知道我可以将它重写为exec(hostname),但我试图避免在我的代码中重写HTTP_HOST的每个实例.
你能想到的任何解决方法?