/** * Load new mails from the dump * * @return void */ public function refresh() { $mails = $this->loadNewMailsFromDump(); foreach ($mails as $mail) { $this->emails[] = $this->parser->parse($mail); } }
function it_parses_unique_links_from_content() { $this->subject->parse(self::SIMPLE_MAIL)->getLinks()->shouldBe(array('http://www.ingenerator.com/foo?bar=baz')); $this->subject->parse(self::HTML_MAIL)->getLinks()->shouldBe(array('https://ccstravel.dev/register/verify?token=0uAdL%2BRD0XnnnH%2Be-1409482211-7ea81e981ad6c8f8b2e41d74b257c147e664087f', 'http://ccstravel.dev/')); }
/** * @param \Ingenerator\Mailhook\EmailParser $parser * @param \Ingenerator\Mailhook\Email $email1 * @param \Ingenerator\Mailhook\Email $email2 */ function its_get_emails_returns_parsed_emails_when_refreshed($parser, $email1, $email2) { $parser->parse(new StringRegexToken('/^From vagrant@ccstravel.dev/'))->willReturn($email1); $parser->parse(new StringRegexToken('/^From test@ingenerator.com/'))->willReturn($email2); $this->given_dump_file(self::MULTI_MAIL_DUMP); $this->subject->refresh(); $this->subject->getEmails()->shouldBe(array($email1, $email2)); }