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