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.
This commit is contained in:
Robert Hafner 2013-12-05 13:57:34 -08:00
parent 554c22a363
commit 01f5ad02a8
3 changed files with 23 additions and 3 deletions

View File

@ -18,5 +18,8 @@ namespace Fetch\Test;
*/
class AttachmentTest extends \PHPUnit_Framework_TestCase
{
public function testGetData()
{
}
}

View File

@ -19,4 +19,9 @@ namespace Fetch\Test;
class MessageTest extends \PHPUnit_Framework_TestCase
{
public function testGetMessageBody()
{
}
}

View File

@ -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);
}
}