From 01f5ad02a898cb7b1ea306e4efc916b5c1260c5b Mon Sep 17 00:00:00 2001 From: Robert Hafner Date: Thu, 5 Dec 2013 13:57:34 -0800 Subject: [PATCH] Created initial working test suite So far it just tests some flags (which it already did) and then tests connecting to the imap server itself. The Attachment and Message tests are just stubs right now and don't do anything, but need those stubs to let the tests occur. --- tests/Fetch/Test/AttachmentTest.php | 3 +++ tests/Fetch/Test/MessageTest.php | 5 +++++ tests/Fetch/Test/ServerTest.php | 18 +++++++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/Fetch/Test/AttachmentTest.php b/tests/Fetch/Test/AttachmentTest.php index 6d13fb2..09d4d4d 100644 --- a/tests/Fetch/Test/AttachmentTest.php +++ b/tests/Fetch/Test/AttachmentTest.php @@ -18,5 +18,8 @@ namespace Fetch\Test; */ class AttachmentTest extends \PHPUnit_Framework_TestCase { + public function testGetData() + { + } } diff --git a/tests/Fetch/Test/MessageTest.php b/tests/Fetch/Test/MessageTest.php index 5a3536f..258c1a9 100644 --- a/tests/Fetch/Test/MessageTest.php +++ b/tests/Fetch/Test/MessageTest.php @@ -19,4 +19,9 @@ namespace Fetch\Test; class MessageTest extends \PHPUnit_Framework_TestCase { + public function testGetMessageBody() + { + + } + } diff --git a/tests/Fetch/Test/ServerTest.php b/tests/Fetch/Test/ServerTest.php index 6514cca..761f843 100644 --- a/tests/Fetch/Test/ServerTest.php +++ b/tests/Fetch/Test/ServerTest.php @@ -27,14 +27,13 @@ class ServerTest extends \PHPUnit_Framework_TestCase */ public function testFlags($expected, $port, $flags) { - $host = 'example.com'; - $server = new Server($host, $port); + $server = new Server(TESTING_SERVER_HOST, $port); foreach ($flags as $flag => $value) { $server->setFlag($flag, $value); } - $this->assertEquals(str_replace('%host%', $host, $expected), $server->getServerString()); + $this->assertEquals(str_replace('%host%', TESTING_SERVER_HOST, $expected), $server->getServerString()); } public function flagsDataProvider() { @@ -54,4 +53,17 @@ class ServerTest extends \PHPUnit_Framework_TestCase array('{%host%:100}', 100, array('user' => 'foo', 'user' => false)), ); } + + public function testConnection() + { + $server = new Server(TESTING_SERVER_HOST); + $server->setAuthentication(TEST_USER, TEST_PASSWORD); + $imapSteam = $server->getImapStream(); + + #$this->assertInstanceOf('resource', $imapSteam); + $this->assertInternalType('resource', $imapSteam); + } + + + }