Skip to content

Commit

Permalink
Adds some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobemerick committed Jan 25, 2016
1 parent d128ac0 commit ee71d82
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/ArchangelTest.php
Expand Up @@ -281,6 +281,24 @@ public function testAddAttachmentWithTitle()
);
}

public function testSend()
{
$archangel = new Archangel();
$archangel->addTo('test@example.com');
$archangel->setSubject('Test Subject');
$archangel->setPlainMessage('Plain text message');
$response = $archangel->send();

$expectedResponse = array(
'to' => 'test@example.com',
'subject' => 'Test Subject',
'message' => 'Plain text message' . Archangel::LINE_BREAK,
'headers' => 'X-Mailer: PHP/6.0.0' . Archangel::LINE_BREAK,
);

$this->assertEquals($expectedResponse, $response);
}

/**
* @dataProvider dataCheckRequiredFields
*/
Expand Down Expand Up @@ -411,6 +429,28 @@ public function dataCheckRequiredFields()
);
}

public function testBuildTo()
{
$archangel = new Archangel();
$addressesProperty = $this->getProtectedProperty('toAddresses');
$addressesProperty->setValue($archangel, array('test@example.com'));
$buildMethod = $this->getProtectedMethod('buildTo');
$toAddresses = $buildMethod->invoke($archangel);

$this->assertEquals('test@example.com', $toAddresses);
}

public function testBuildToMultiple()
{
$archangel = new Archangel();
$addressesProperty = $this->getProtectedProperty('toAddresses');
$addressesProperty->setValue($archangel, array('testOne@example.com', 'testTwo@example.com'));
$buildMethod = $this->getProtectedMethod('buildTo');
$toAddresses = $buildMethod->invoke($archangel);

$this->assertEquals('testOne@example.com, testTwo@example.com', $toAddresses);
}

public function testGetBoundary()
{
$archangel = new Archangel();
Expand Down
8 changes: 8 additions & 0 deletions tests/function-overrides.php
Expand Up @@ -2,6 +2,14 @@

namespace Jacobemerick\Archangel;

function mail($to, $subject, $message, $headers) {
return compact('to', 'subject', 'message', 'headers');
}

function phpversion() {
return '6.0.0';
}

function uniqid() {
return '1234567890123';
}

0 comments on commit ee71d82

Please sign in to comment.