/** * @param \Ingenerator\Mailhook\EmailListFilterer $filterer * @param \Ingenerator\Mailhook\Email $email_1 * @param \Ingenerator\Mailhook\Email $email_2 * * @throws \PhpSpec\Exception\Example\FailureException */ function it_throws_if_any_matching_emails($filterer, $email_1, $email_2) { $filterer->filterEmails(Argument::any(), Argument::any())->willReturn(array($email_1, $email_2)); try { $this->subject->assert(); throw new FailureException("Expected EmailAssertionFailedException"); } catch (EmailAssertionFailedException $e) { // Expected } }
/** * @param EmailMatcher $matcher,... Matchers to run * * @return null */ public function noEmailMatching($matcher = NULL) { $matchers = func_get_args(); return $this->negative_runner->assert($matchers) ?: NULL; }
/** * @param \Ingenerator\Mailhook\Assert\NegativeAssertionRunner $negative_runner * @param \Ingenerator\Mailhook\EmailMatcher $matcher1 * @param \Ingenerator\Mailhook\EmailMatcher $matcher2 */ function it_runs_negative_assertions_with_matchers($negative_runner, $matcher1, $matcher2) { $negative_runner->assert(Argument::any())->willReturn(array()); $this->subject->noEmailMatching($matcher1, $matcher2)->shouldBe(NULL); $negative_runner->assert(array($matcher1, $matcher2))->shouldHaveBeenCalled(); }