输入我想填写:
<input type="text" id="order-number" name="order_numbers[]" class="form-control">
我的单元测试代码:
public function testSearch()
{
$this->actAsUser();
$this->visit('/orders')
->type('12001546', 'order_numbers[]');
}
我收到错误:
1) OrdersTest::testSearch
InvalidArgumentException: Unreachable field ""
答案 0 :(得分:1)
我遇到了同样的问题,找不到比
更好的解决方案// TestCase.php
protected function storeArrayInput($values, $name)
{
$this->inputs[$name] = $values;
return $this;
}
// YourTest.php
public function testSearch()
{
$this->actAsUser();
$this->visit('/orders')
->storeArrayInput(['12001546'], 'order_numbers');
}