Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DomCrawler] impossible to test a value out of the options in ChoiceFormField#47642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jorissae wants to merge1 commit intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromjorissae:impossible-to-test-a-value-out-of-the-options

Conversation

jorissae
Copy link
Contributor

@jorissaejorissae commentedSep 21, 2022
edited
Loading

QA
Branch?6.2
Bug fix?No
New feature?No
Deprecations?No
Tickets>
LicenseMIT
Doc PR

I couldn't test a value outside of the ChoiceForm field option nodes.
For example, even if my combobox does not offer the empty field, I want to test my NotBlank validator.

<?php$form =$crawler->selectButton('ea[newForm][btn]')->form();$client->submit($form, ['Item[vat]' =>'']);

in Symfony\Component\BrowserKit\AbstractBrowser::submit ($client->submit())

publicfunctionsubmit(Form$form,array$values = [],array$serverParameters = []):Crawler{$form->setValues($values);return$this->request($form->getMethod(),$form->getUri(),$form->getPhpValues(),$form->getPhpFiles(),$serverParameters);}

InvalidArgumentException: Input "Item[vat]" cannot take "" as a value (possible values: "0", "700", "1900").

maybe there is another solution ? (like add arguments bool $throw = true to setValues or another ...)

Thanks

norkunas reacted with thumbs up emoji
@carsonbotcarsonbot added this to the6.2 milestoneSep 21, 2022
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbotcarsonbot changed the titleimpossible to test a value out of the options in ChoiceFormField[DomCrawler] impossible to test a value out of the options in ChoiceFormFieldSep 21, 2022
@carsonbot
Copy link

Hey!

I think@localheinz has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@nicolas-grekasnicolas-grekas modified the milestones:6.2,6.3Nov 5, 2022
@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@norkunas
Copy link
Contributor

Does nobody test autocomplete fields? 😅
Would be great addition.

@yceruto
Copy link
Member

If the option doesn't exist is because it's added dynamically via Javascript, so you'll need to simulate that behavior by usingChoiceFormField::addChoice($node) method before submit.

I don't think we should remove the validation check.

norkunas and gus3000 reacted with thumbs up emoji

@xabbuhxabbuh modified the milestones:7.1,7.2May 15, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

7 participants
@jorissae@carsonbot@norkunas@yceruto@fabpot@nicolas-grekas@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp