From 8cba263bbcc182839695c068abf145195a07bffc Mon Sep 17 00:00:00 2001 From: uckelman Date: Sat, 20 Mar 2010 13:46:11 +0000 Subject: Completed tests for most EmailMessage methods. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6619 67b53d14-2c14-4ace-a08f-0dab2b34000c --- test/EmailMessageTest.php | 82 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 18 deletions(-) (limited to 'test/EmailMessageTest.php') 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(); } - } ?> -- cgit v1.2.3