/** * {@inheritdoc} */ public function matches(Email $email) { if ($this->url_pattern) { return (bool) $email->getLinksMatching($this->url_pattern); } else { return (bool) $email->getLinks(); } }
/** * @param \Ingenerator\Mailhook\Email $email */ function it_matches_email_containing_text($email) { $this->beConstructedWith('Some text'); $email->getContent()->willReturn('This email has Some text that matches'); $this->subject->matches($email)->shouldBe(TRUE); }
/** * @param \Ingenerator\Mailhook\Email $email */ function it_matches_email_with_matching_link_when_pattern_provided($email) { $this->beConstructedWith('/reset/'); $email->getLinksMatching('/reset/')->willReturn(array('href' => 'http://foo.bar/reset')); $this->subject->matches($email)->shouldBe(TRUE); }
function it_filters_links_by_regular_expression() { $this->subject->beConstructedWith(array('links' => array('https://www.ingenerator.com/test/matching-url', 'https://www.ingenerator.com/test/notmatch-url'))); $this->subject->getLinksMatching('_matching-url$_')->shouldBe(array('https://www.ingenerator.com/test/matching-url')); }
/** * {@inheritdoc} */ public function matches(Email $email) { return $email->getTo() === $this->recipient; }
/** * {@inheritdoc} */ public function matches(Email $email) { return strpos($email->getContent(), $this->text) !== FALSE; }
/** * @param \Ingenerator\Mailhook\Email $email */ function it_matches_email_sent_to_recipient($email) { $this->subject->beConstructedWith('*****@*****.**'); $email->getTo()->willReturn('*****@*****.**'); $this->subject->matches($email)->shouldBe(TRUE); }