Ctrl+'s avatar
Level 14

Test input arrays in laravel 5.5 ignore empty or null input values

I am currently testing a championship tree with 16 competitors.

Each competitor can be updated via a select combo.

Now, when testing this functionality in Laravel 5.5, I do:

$this->select([
        $competitor1->id,
        $competitor2->id,
        $competitor3->id,
        $competitor4->id,
        $competitor5->id,
], 'fighters[]')
        ->press('update');

that will put a value on the 5 first combos.

Now, If I try to insert a null, or a "" , it is ignored and removed from the select method, so I can only test the first entries, I cannot test the first and the fourth only for example.

Is it something I am not doing properly?

0 likes
2 replies
shez1983's avatar

bit hacky.. but cant u put 0, for the ones you dont want and in your controller discount those..

Ctrl+'s avatar
Level 14

mmm this is exactly what I would like to avoid... :)

Please or to participate in this conversation.