1
我想用Laravels內置的應用程序測試框架進行應用程序測試。 Due to the documentation你可以選中一個複選框以:如何在使用Laravel進行測試時選中複選框
// HTML
<input name="accept-terms" type="checkbox">
// PHP
$this
->visit('/foo/bar')
->check('accept-terms')
工作正常。但是,有時我有很多複選框。像:
// HTML
<input id="feature-1" name="features[]" type="checkbox" value="1">
<input id="feature-2" name="features[]" type="checkbox" value="2">
<input id="feature-3" name="features[]" type="checkbox" value="3">
// PHP
$this
->visit('/foo/bar')
->check('#feature-1')
我叫不上名字獲取它們(如上),所以我想通過自己的身份證拿來。但是,它似乎不支持,因爲我總是得到一個unreachable field
錯誤。
這可能會實現:'$這個 - >訪問( '/富/酒吧') - >獲取( '功能[]')[0] - >打勾()' –
當然,你的意思是'GET' ? 'get'的確會觸發一個HTTP GET請求。 – miho