mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Add tests to ensure exceptions are flung and fixed wrong variable name used
This commit is contained in:
parent
35c65aaa57
commit
bdeadc1a01
@ -43,12 +43,12 @@ class Mailgun{
|
||||
fwrite($fileHandle, $postFiles);
|
||||
|
||||
$result = $this->post("$workingDomain/messages.mime", $postData, array("message" => $tempFile));
|
||||
fclose($fileName);
|
||||
unlink($fileName);
|
||||
fclose($fileHandle);
|
||||
unlink($tempFile);
|
||||
return $result;
|
||||
}
|
||||
else{
|
||||
throw new Exceptions\git (EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
|
||||
throw new Exceptions\MissingRequiredMIMEParameters(EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,35 @@ class BatchMessageTest extends \Mailgun\Tests\MailgunTestCase{
|
||||
|
||||
$this->assertEquals(array("1234"), $message->getMessageIds());
|
||||
}
|
||||
|
||||
public function testInvalidMissingRequiredMIMEParametersExceptionGetsFlungNoFrom()
|
||||
{
|
||||
$this->setExpectedException("\\Mailgun\\Messages\\Exceptions\\MissingRequiredMIMEParameters");
|
||||
|
||||
$message = $this->client->BatchMessage($this->sampleDomain);
|
||||
$message->sendMessage([1,2,3]);
|
||||
}
|
||||
public function testInvalidMissingRequiredMIMEParametersExceptionGetsFlungNoTo()
|
||||
{
|
||||
$this->setExpectedException("\\Mailgun\\Messages\\Exceptions\\MissingRequiredMIMEParameters");
|
||||
|
||||
$message = $this->client->BatchMessage($this->sampleDomain);
|
||||
$message->sendMessage(["from" => 1, 2,3]);
|
||||
}
|
||||
public function testInvalidMissingRequiredMIMEParametersExceptionGetsFlungNoSubject()
|
||||
{
|
||||
$this->setExpectedException("\\Mailgun\\Messages\\Exceptions\\MissingRequiredMIMEParameters");
|
||||
|
||||
$message = $this->client->BatchMessage($this->sampleDomain);
|
||||
$message->sendMessage(["from" => 1, "to" => 2,3]);
|
||||
}
|
||||
public function testInvalidMissingRequiredMIMEParametersExceptionGetsFlungNoTextOrHtml()
|
||||
{
|
||||
$this->setExpectedException("\\Mailgun\\Messages\\Exceptions\\MissingRequiredMIMEParameters");
|
||||
|
||||
$message = $this->client->BatchMessage($this->sampleDomain);
|
||||
$message->sendMessage(["from" => 1,"to" => 2,"subject" => 3]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user