minkphp / minkphp/Mink

selectFieldOption breaks if null value passed

Open
#773 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.6k
Forks
286
PR merge metrics
No merged PRs in 30d

Description

I think that we should normalize the value to empty string if null is passed.
If you need a working example, I'll provide it in the week end but it is pretty clear looking at
https://github.com/minkphp/Mink/blob/master/src/Selector/NamedSelector.php#L208
and
https://github.com/minkphp/Mink/blob/master/src/Selector/NamedSelector.php#L224

Basically, %locator% are never replaced and so no possible way to produce a valid xpath.

If value normalization is note feasabe (as empty string could be a valid use case?) we should throw an exception.

If you all agree to replace null with empty string (or to throw an exception), I'll be happy to make a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/Selector/NamedSelector.php at the referenced lines around 208 and 224, then reproduce selectFieldOption with a null value. Confirm the expected handling with maintainers; done means the locator is valid through normalization or the call consistently raises the agreed exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.