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'
                )
            );
        }
    }
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'
                )
            );
        }
    }
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' ) ) ; } }
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
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 .