You are here

public function WebAssert::fieldValueNotEquals in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::fieldValueNotEquals()

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

ExpectationException

File

vendor/behat/mink/src/WebAssert.php, line 689

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function fieldValueNotEquals($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 it should not be.', $field, $actual);
  $this
    ->assert(!preg_match($regex, $actual), $message);
}