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, "...")));
                }
            }
        }
    }
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, "...")));
                }
            }
        }
    }
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 , "..." ) ) ) ; } } } }
Compare actual mail with expected mail.

@param array $actualMail
An array of actual mail.
@param array $expectedMail
An array of expected mail.
Compare actual mail with expected mail .