0
我寫了這個簡單的測試:symfony的2和PHPUnit的履帶客戶端沒有達到ngnix
<?php
namespace Hello\ApiBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class HelloControllerTest extends WebTestCase {
public function test() {
$client = static::createClient();
$crawler = $client->request("GET","http://localhost/hello");
$response = $client->getResponse()->getStatusCode();
var_dump($response);
}
}
?>
當我運行這個測試,它打印404個狀態碼。
奇怪的是,我沒有看到ngninx訪問日誌上的請求。即使我將URL更改爲"/hello"
,它仍然看起來像請求未到達本地Web服務器。
不用說,如果我只是打開Chrome並正常嘗試使用此URL(http://localhost/hello
),它就可以工作。
- 我錯過了什麼?