/**
  * @Given /^I follow the (\w+) URL in the latest email to ([^ ]+@[^ ]+)$/
  */
 public function followEmailUrl($ordinal, $email)
 {
     require_once __DIR__ . '/fake-mail.php';
     $emails = a8c_vip_get_fake_mail_for($email);
     $message = a8c_vip_read_fake_mail(array_pop($emails));
     // Nicked this regex from WordPress make_clickable
     preg_match_all('#\\bhttps?://[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^[:punct:]\\s]|/))#', $message['body'], $matches);
     $links = $matches[0];
     $ordinals = array('first' => 1, 'second' => 2, 'third' => 3, 'fourth' => 4, 'fifth' => 5, 'sixth' => 6, 'seventh' => 7, 'eighth' => 8, 'ninth' => 9, 'tenth' => 10);
     $ordinal = strtolower($ordinal);
     if (!isset($ordinals[$ordinal])) {
         $message = sprintf('Could not identify ordinal "%s" (n.b. we only go up to "tenth")', $ordinal);
         throw new \Behat\Mink\Exception\ExpectationException($message, $this->getSession());
     }
     $i = $ordinals[$ordinal];
     // Our array is zero indexed
     $i--;
     if (!isset($links[$i])) {
         $message = sprintf('Could not find a %s link amongst: %s', $ordinal, implode(', ', $links));
         throw new \Behat\Mink\Exception\ExpectationException($message, $this->getSession());
     }
     //		throw new \Behat\Mink\Exception\ExpectationException($links[$i], $this->getSession());
     $this->getSession()->visit($links[$i]);
 }
 /**
  * @Given /^I should not see an email to ([^ ]+@[^ ]+)$/
  */
 public function assertNoEmailTo($email_address)
 {
     require_once __DIR__ . '/fake-mail.php';
     $emails = a8c_vip_get_fake_mail_for($email_address);
     if (!empty($emails)) {
         $message = a8c_vip_read_fake_mail(array_pop($emails));
         $exception_message = sprintf('There should be no email to %s, but at least one was found the first had the subject: %s', $email_address, $message['subject']);
         throw new \Behat\Mink\Exception\ExpectationException($exception_message, $this->getSession());
     }
 }