php - Laravel 5.1 - Testing a multiple selectbox -


i'm experiencing trouble when write tests multiple select box laravel 5.1 testing helpers.

i've tried both storeinput , select kinda alias storeinput. when i'm working multiple select , want input formatted array i've created <select name="roles[]"> not testable, can't write $this->storeinput( 'roles[]', [ 1, 2 ] ). errors are:

symfony\component\cssselector\exception\syntaxerrorexception: expected identifier or "*", found.`

how possible go around? i've tested id error `unreachable field "the_id".

the way did create override of storeinput follows (i put in base testcase reach tests):

public function storeinput($element, $text, $force = false) {     if ($force) {         $this->inputs[$element] = $text;         return $this;     }     else {         return parent::storeinput($element, $text);     } } 

and when testing multiselect, strip off trailing braces identifier pass method:

$this->storeinput('roles', [1, 2], true); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -