You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using DomCrawler in a test case, one is able to set the value of a Choice form field using the setValue()method, The implementation of this method checks if the value to be set matches one of the <option> elements for the specific <select>. When the <select> is populated via Javascript (using select2 or tom-select for example), those <option> elements are not available during the test.
Since the \Symfony\Component\DomCrawler\Field\ChoiceFormField::disableValidation method is internal, I should not use it in my test. Would it be better to add this method to the API, or to add a flag to the setValue() method which disables the 'is the option available' check?
Example
// Ajax populated field using internal 'disableValidation'$personField= $form['create[person]'];
self::assertInstanceOf(ChoiceFormField::class, $personField);
$personField->disableValidation()->setValue('CMD1A1A');
// Regular <select>$nationalityVeld = $form['create[nationality]'];
self::assertInstanceOf(ChoiceFormField::class, $nationalityVeld);
$nationalityVeld->setValue('NED');
The text was updated successfully, but these errors were encountered:
Description
When using DomCrawler in a test case, one is able to set the value of a Choice form field using the
setValue()
method, The implementation of this method checks if the value to be set matches one of the<option>
elements for the specific<select>
. When the<select>
is populated via Javascript (using select2 or tom-select for example), those<option>
elements are not available during the test.Since the \Symfony\Component\DomCrawler\Field\ChoiceFormField::disableValidation method is internal, I should not use it in my test. Would it be better to add this method to the API, or to add a flag to the
setValue()
method which disables the 'is the option available' check?Example
The text was updated successfully, but these errors were encountered: