2013-07-23 09:11:01 +04:00
< ? PHP
namespace Mailgun\Tests\Connection ;
use Mailgun\Common\Client ;
class ConnectionTest extends \Mailgun\Tests\MailgunTestCase {
2013-07-24 01:29:45 +04:00
private $client ;
2013-07-23 09:11:01 +04:00
public function setUp (){
2013-07-24 01:29:45 +04:00
$this -> client = new Client ( \DEFAULT_MG_API_KEY , \DEFAULT_MG_DOMAIN , false );
2013-07-23 09:11:01 +04:00
}
2013-07-24 01:29:45 +04:00
public function testNewClientConnection (){
$result = $this -> client -> validateCredentials ();
2013-07-23 09:11:01 +04:00
$this -> assertTrue ( $result );
}
2013-07-24 01:29:45 +04:00
public function testSendSimpleTestMessage (){
$result = $this -> client -> sendMessage ( array ( " from " => " Excited User <me@samples.mailgun.org> " , " to " => " travis@tswientek.com " , " subject " => " Hello " , " text " => " PHP Unit Test Success! " , " o:testmode " => true ));
$status = $result -> getStatusCode ();
$this -> assertEquals ( " 200 " , $status );
2013-07-23 09:11:01 +04:00
}
}
?>