minkphp / minkphp/Mink

fieldValueEquals does not support multiple select

Open
#704 4 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

When I use the assert "assertFieldContains" on an element "select" with attribute "multiple", I have this error:

Notice: Array to string conversion in vendor/behat/mink/src/WebAssert.php line 678

This error correspond to the method WebAssert::fieldValueEquals():

$message = sprintf('The field "%s" value is "%s", but "%s" expected.', $field, $actual, $value);

$actual is an array, not a string as for a simple select.

Example:

// html
<form>
    <select id="alphabet-id" name="alphabet" multiple>
        <option value="a">a</option>
    </select>
</form>
// feature
...
Then the "alphabet-id" field should contain "a"

Spec:

PHP 5.6.22
"behat/behat": "^3.0",
"behat/mink": "^1.7",
"behat/mink-extension": "^2.2",

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

Start in vendor/behat/mink/src/WebAssert.php at line 678 and inspect WebAssert::fieldValueEquals(), using the reported multiple-select example as the reproduction case. Verify the assertion with a multiple select and confirm that the expected behavior is handled without an array-to-string notice.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.