diff options
Diffstat (limited to 'test/EmailMessageTest.php')
-rw-r--r-- | test/EmailMessageTest.php | 82 |
1 files changed, 64 insertions, 18 deletions
diff --git a/test/EmailMessageTest.php b/test/EmailMessageTest.php index f544477..ffbd666 100644 --- a/test/EmailMessageTest.php +++ b/test/EmailMessageTest.php @@ -2,40 +2,86 @@ require_once('PHPUnit/Framework.php'); +require_once('src/EmailMessage.php'); + class EmailMessageTest extends PHPUnit_Framework_TestCase { - - /** @test */ - public function testGetSource() { + + public function provider() { + return array( + array(array( + 'file' => __DIR__ . '/1', + 'source' => '', + 'post_id' => '', + 'from' => 'uckelman@nomic.net', + 'subject' => 'Re: [Developers]Re: Adding developers?', + 'message_id' => '<20100302094228.33F0310091@charybdis.ellipsis.cx>', + 'in_reply_to' => '<1267473003.m2f.17543@www.vassalengine.org>', + 'references' => '<1267171317.m2f.17507@www.vassalengine.org> <1267473003.m2f.17543@www.vassalengine.org>', + 'body' => '' + )) + ); } - /** @test */ - public function testGetPostId() { + /** + * @dataProvider provider + */ + public function testGetSource($expected) { + $this->markTestIncomplete(); } - /** @test */ - public function testGetFrom() { + /** + * @dataProvider provider + */ + public function testGetPostId($expected) { + $this->markTestIncomplete(); } - /** @test */ - public function testGetSubject() { + /** + * @dataProvider provider + */ + public function testGetFrom($expected) { + $msg = new EmailMessage(file_get_contents($expected['file'])); + $this->assertEquals($expected['from'], $msg->getFrom()); + } + + /** + * @dataProvider provider + */ + public function testGetSubject($expected) { + $msg = new EmailMessage(file_get_contents($expected['file'])); + $this->assertEquals($expected['subject'], $msg->getSubject()); } - /** @test */ - public function testGetMessageId() { + /** + * @dataProvider provider + */ + public function testGetMessageId($expected) { + $msg = new EmailMessage(file_get_contents($expected['file'])); + $this->assertEquals($expected['message_id'], $msg->getMessageId()); } - /** @test */ - public function testGetInReplyTo() { + /** + * @dataProvider provider + */ + public function testGetInReplyTo($expected) { + $msg = new EmailMessage(file_get_contents($expected['file'])); + $this->assertEquals($expected['in_reply_to'], $msg->getInReplyTo()); } - /** @test */ - public function testGetReferences() { + /** + * @dataProvider provider + */ + public function testGetReferences($expected) { + $msg = new EmailMessage(file_get_contents($expected['file'])); + $this->assertEquals($expected['references'], $msg->getReferences()); } - /** @test */ - public function testGetBody() { + /** + * @dataProvider provider + */ + public function testGetBody($expected) { + $this->markTestIncomplete(); } - } ?> |