Checks if the desired number of emails was sent.
If no argument is provided then at least one email must be sent to satisfy the check.

``` php
<?php
$I->seeEmailIsSent(2);
?>
```

@param null|int $expectedCount
162084
public function seeEmailIsSent($expectedCount = null)
    {
        $profile = $this->getProfile();
        if (!$profile) {
            $this->fail('Emails can\'t be tested without Profiler');
        }
        if (!$profile->hasCollector('swiftmailer')) {
            $this->fail('Emails can\'t be tested without SwiftMailer connector');
        }

        if (!is_int($expectedCount) && !is_null($expectedCount)) {
            $this->fail(sprintf(
                'The required number of emails must be either an integer or null. "%s" was provided.',
                print_r($expectedCount, true)
            ));
        }

        $realCount = $profile->getCollector('swiftmailer')->getMessageCount();
        if ($expectedCount === null) {
            $this->assertGreaterThan(0, $realCount);
        } else {
            $this->assertEquals(
                $expectedCount,
                $realCount,
                sprintf(
                    'Expected number of sent emails was %d, but in reality %d %s sent.',
                    $expectedCount,
                    $realCount,
                    $realCount === 2 ? 'was' : 'were'
                )
            );
        }
    }
110643
protected function processReaderFeedback(Reader $reader, int $expectedTestCount)
    {
        $feedbackItems = $reader->getFeedback();

        $actualTestCount = \count($feedbackItems);

        $this->processTestOverhead($actualTestCount, $expectedTestCount);

        foreach ($feedbackItems as $item) {
            $this->printFeedbackItem($item);
            if ($item === 'S') {
                ++$this->totalSkippedOrIncomplete;
            }
        }

        if ($this->processSkipped) {
            $this->printSkippedAndIncomplete($actualTestCount, $expectedTestCount);
        }
    }
151406
private function requestHeadersMatchExpectation(ServerRequestInterface $httpRequest, RequestConditions $expectedRequest)
    {
        $inputSource = $this->inputSourceLocator->locate('header');
        foreach ($expectedRequest->getHeaders() as $header => $headerCondition) {
            $matcher = $this->matcherLocator->locate(
                $headerCondition->getMatcher()->asString()
            );

            $matches = $matcher->match(
                $inputSource->getValue($httpRequest, $header->asString()),
                $headerCondition->getValue()->asString()
            );
            if (!$matches) {
                return false;
            }
        }

        return true;
    }
546056
public function seeQueueHasCurrentCount($queue, $expected)
    {
        $this->assertEquals($expected, $this->queueDriver->getMessagesCurrentCountOnQueue($queue));
    }
779851
protected function __isValueMatchAsExpected($value, $expectedString)
    {
        $match = false;

        if ($expectedString === null)
            ## undefined expected values must not be NULL
            ## except when it write down on docblock "@return void"
            return $value === null;

        $valueType = strtolower(gettype($value));

        /**
         * @return string|null|object|\Stdclass|void
         */
        $expectedString = explode('|', $expectedString);
        foreach($expectedString as $ext) {
            $ext = strtolower(trim($ext));
            if ($ext == '') continue;

            if ($value === VOID && $ext == 'void')
                $match = true;
            elseif ($valueType === $ext && $value != null)
                $match = true;
            elseif ($valueType === 'object') {
                if (is_a($value, $ext))
                    $match = true;
            }

            if ($match) break;
        }

        return $match;
    }
396357
public function assertNotCount($expectedCount, $message = '')
    {
        Assert::assertNotCount($expectedCount, $this->getData(), $message);

        return $this;
    }
1001371
private function isMatch(Rule $expected, array $value): bool
    {
        return 0 === count(array_diff(array_keys($expected->getReflectedMap()), array_keys($value)));
    }
910849
public function equals(ServerRequestInterface $httpRequest, MockConfig $expectation)
    {
        $this->logger->debug('Checking if request matches an expectation');

        if (!$this->isExpectedScenarioState($expectation)) {
            return false;
        }

        $expectedRequest = $expectation->getRequest();

        $atLeastOneExecution = $this->compareRequestParts($httpRequest, $expectedRequest);

        if (null !== $atLeastOneExecution && $expectedRequest->getHeaders()) {
            $this->logger->debug('Checking headers against expectation');

            return $this->requestHeadersMatchExpectation($httpRequest, $expectedRequest);
        }

        return (bool) $atLeastOneExecution;
    }
98052
public function seeInEmailSubject($expected)
    {
        $email = $this->fetchLastMessage();
        $this->assertContains($expected, $email->subject, 'Email subject contains text');
    }
630123
private function assertFormHasValidationMessage($expectedMessage)
    {
        Assert::true(
            $this->createPage->hasFormValidationError($expectedMessage),
            sprintf(
                'The validation message "%s" was not found on the page.',
                $expectedMessage
            )
        );
    }
642023
protected function matchRequestProperty($propertyName, $expectedValue, $weight)
    {
        if ($this->request === null) {
            return false;
        }

        $value = ObjectAccess::getProperty($this->request, $propertyName);
        if ($value === $expectedValue) {
            $this->addWeight($weight);
            return true;
        }

        return false;
    }
542658
protected function write($line, $expectedCode = null, $message = null)
    {
        fwrite($this->_connection, $line . "\r\n");
        if (!$expectedCode) {
            return;
        }
        $response = $this->read();
        if (!in_array((int) $response, (array) $expectedCode, true)) {
            throw new NetException('SMTP server did not accept ' . ($message ? $message : $line) . ' with error: ' . trim($response));
        }
    }
599576
protected function compareMail($actualMail, $expectedMail)
    {
        // Make sure there is the same number of actual and expected.
        $expectedCount = count($expectedMail);
        $this->assertMailCount($actualMail, $expectedCount);

        // For each row of expected mail, check the corresponding actual mail.
        // Make the comparison insensitive to the order mails were sent.
        $actualMail = $this->sortMail($actualMail);
        $expectedMail = $this->sortMail($expectedMail);
        foreach ($expectedMail as $index => $expectedMailItem) {
            // For each column of the expected, check the field of the actual mail.
            foreach ($expectedMailItem as $fieldName => $fieldValue) {
                $expectedField = [$fieldName => $fieldValue];
                $match = $this->matchesMail($actualMail[$index], $expectedField);
                if (!$match) {
                    throw new \Exception(sprintf("The #%s mail did not have '%s' in its %s field. It had:\n'%s'", $index, $fieldValue, $fieldName, mb_strimwidth($actualMail[$index][$fieldName], 0, 30, "...")));
                }
            }
        }
    }
935506
protected function checkThrowable($throwable, $expectedClass, $expectedMsg, $expectedCode)
    {
        if (!($throwable instanceof $expectedClass)) {
            $this->fail(sprintf(
                "Exception of class '$expectedClass' expected to be thrown, but class '%s' was caught",
                get_class($throwable)
            ));
        }

        if (null !== $expectedMsg && $throwable->getMessage() !== $expectedMsg) {
            $this->fail(sprintf(
                "Exception of class '$expectedClass' expected to have message '$expectedMsg', but actual message was '%s'",
                $throwable->getMessage()
            ));
        }

        if (null !== $expectedCode && $throwable->getCode() !== $expectedCode) {
            $this->fail(sprintf(
                "Exception of class '$expectedClass' expected to have code '$expectedCode', but actual code was '%s'",
                $throwable->getCode()
            ));
        }

        $this->assertTrue(true); // increment assertion counter
    }
7532
public function assertGreaterThanOrEqual($expected, $message = '')
    {
        Assert::assertGreaterThanOrEqual($expected, $this->getData(), $message);

        return $this;
    }
93559
private function message(string $expectedRowCount, int $actualRowCount, string $query): string
  {
    $query = trim($query);

    $message = 'Wrong number of rows selected.';
    $message .= "\n";
    $message .= sprintf("Expected number of rows: %s.\n", $expectedRowCount);
    $message .= sprintf("Actual number of rows: %s.\n", $actualRowCount);
    $message .= 'Query:';
    $message .= (strpos($query, "\n")!==false) ? "\n" : ' ';
    $message .= $query;

    return $message;
  }
146347
public function seeInEmailHtmlBody($expected)
    {
        $email = $this->fetchLastMessage();
        $this->assertContains($expected, $email->html_body, 'Email body contains HTML');
    }