public function WebAssert::elementAttributeNotContains in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::elementAttributeNotContains()
Checks that an attribute of a specific elements does not contain text.
Parameters
string $selectorType:
string|array $selector:
string $attribute:
string $text:
Throws
File
- vendor/
behat/ mink/ src/ WebAssert.php, line 606
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function elementAttributeNotContains($selectorType, $selector, $attribute, $text) {
$element = $this
->elementAttributeExists($selectorType, $selector, $attribute);
$actual = $element
->getAttribute($attribute);
$regex = '/' . preg_quote($text, '/') . '/ui';
$message = sprintf('The text "%s" was found in the attribute "%s" of the %s.', $text, $attribute, $this
->getMatchingElementRepresentation($selectorType, $selector));
$this
->assertElement(!preg_match($regex, $actual), $message, $element);
}