/** * Test example messages */ public function testExampleMessages() { foreach (new DirectoryIterator(dirname(dirname(dirname(__DIR__))) . '/example_messages') as $file) { if ($file->isDot() || $file->isDir()) { continue; } if ($file->isFile() && $file->getExtension() == 'eml') { $expected_text = $this->setExpectedTextByFileName($file->getFilename()); $this->assertEquals($expected_text, EmailReplyExtractor::extractReplyEml($file->getPathname())); // assert that text of the stripped emails match the original text even with <br /> instead of new row char $this->assertEquals(nl2br($expected_text), nl2br(EmailReplyExtractor::extractReplyEml($file->getPathname()))); } } }