$this->assert(!empty($links[$index]), $message);
}
+ /**
+ * Passes if a link with the exactly specified label is found.
+ *
+ * An optional link index may be passed.
+ *
+ * @param string $label
+ * Text between the anchor tags.
+ * @param int $index
+ * Link position counting from zero.
+ * @param string $message
+ * (optional) A message to display with the assertion. Do not translate
+ * messages: use strtr() to embed variables in the message text, not
+ * t(). If left blank, a default message will be displayed.
+ *
+ * @throws \Behat\Mink\Exception\ExpectationException
+ * Thrown when element doesn't exist, or the link label is a different one.
+ */
+ public function linkExistsExact($label, $index = 0, $message = '') {
+ $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label]));
+ $links = $this->session->getPage()->findAll('named_exact', ['link', $label]);
+ $this->assert(!empty($links[$index]), $message);
+ }
+
/**
* Passes if a link with the specified label is not found.
*
$this->assert(empty($links), $message);
}
+ /**
+ * Passes if a link with the exactly specified label is not found.
+ *
+ * An optional link index may be passed.
+ *
+ * @param string $label
+ * Text between the anchor tags.
+ * @param string $message
+ * (optional) A message to display with the assertion. Do not translate
+ * messages: use strtr() to embed variables in the message text, not
+ * t(). If left blank, a default message will be displayed.
+ *
+ * @throws \Behat\Mink\Exception\ExpectationException
+ * Thrown when element doesn't exist, or the link label is a different one.
+ */
+ public function linkNotExistsExact($label, $message = '') {
+ $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label]));
+ $links = $this->session->getPage()->findAll('named_exact', ['link', $label]);
+ $this->assert(empty($links), $message);
+ }
+
/**
* Passes if a link containing a given href (part) is found.
*
* @throws \Behat\Mink\Exception\ElementNotFoundException
* @throws \Behat\Mink\Exception\ExpectationException
*/
- public function fieldDisabled($field, TraversableElement $container = NULL) {
+ public function fieldDisabled($field, TraversableElement $container = NULL) {
$container = $container ?: $this->session->getPage();
$node = $container->findField($field);