function WebAssert::fieldValueNotEquals
Checks that specific field have provided value.
Parameters
string $field field id|name|label|value:
string $value field value:
TraversableElement|null $container document to check against:
Return value
void
Throws
File
-
vendor/
behat/ mink/ src/ WebAssert.php, line 795
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function fieldValueNotEquals(string $field, string $value, ?TraversableElement $container = null) {
$node = $this->fieldExists($field, $container);
$actual = $node->getValue();
if (\is_array($actual)) {
throw new \LogicException('Field value assertions cannot be used for multi-select fields as they have multiple values.');
}
$actual = (string) $actual;
$regex = '/^' . preg_quote($value, '/') . '$/ui';
$message = sprintf('The field "%s" value is "%s", but it should not be.', $field, $actual);
$this->assert(!preg_match($regex, $actual), $message);
}