0

Input I am trying to fill:

<input type="text" id="order-number" name="order_numbers[]" class="form-control">

My unit test code:

    public function testSearch()
    {
        $this->actAsUser();
        $this->visit('/orders')
        ->type('12001546', 'order_numbers[]');
    }

Error I am getting:

1) OrdersTest::testSearch
InvalidArgumentException: Unreachable field ""
2
  • how about type('12001546', 'product_ids[]') not order_number[]? Commented Jul 5, 2016 at 12:49
  • Sorry, I had wrong element in the first post, changed it and also fixed typo in unit test code which resulted in new error. Commented Jul 5, 2016 at 12:55

1 Answer 1

1

I had the same problem, couldn't find a better solution than

// 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');
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.