public function WebAssert::fieldValueEquals in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::fieldValueEquals()
Checks that specific field have provided value.
Parameters
string $field field id|name|label|value:
string $value field value:
TraversableElement $container document to check against:
Throws
File
- vendor/
behat/ mink/ src/ WebAssert.php, line 669
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function fieldValueEquals($field, $value, TraversableElement $container = null) {
$node = $this
->fieldExists($field, $container);
$actual = $node
->getValue();
$regex = '/^' . preg_quote($value, '/') . '$/ui';
$message = sprintf('The field "%s" value is "%s", but "%s" expected.', $field, $actual, $value);
$this
->assert((bool) preg_match($regex, $actual), $message);
}