-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from byjg/2.0.1
Fix PHPUnit
- Loading branch information
Showing
18 changed files
with
132 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace ByJG\Mail\Exception; | ||
|
||
class InvalidMailHandlerException extends \Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
namespace ByJG\Mail\Exception; | ||
|
||
|
||
class InvalidMessageFormatException extends \Exception | ||
{ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
namespace ByJG\Mail\Exception; | ||
|
||
|
||
class MailApiException extends \Exception | ||
{ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace ByJG\Mail\Exception; | ||
|
||
class ProtocolNotRegisteredException extends \Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace ByJG\Mail; | ||
|
||
use \PHPUnit\Framework\TestCase; | ||
use ByJG\Mail\Wrapper\AmazonSesWrapper; | ||
use ByJG\Mail\Wrapper\MailgunApiWrapper; | ||
use ByJG\Mail\Wrapper\PHPMailerWrapper; | ||
use ByJG\Mail\Wrapper\SendMailWrapper; | ||
|
||
// backward compatibility | ||
if (!class_exists('\PHPUnit\Framework\TestCase')) { | ||
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); | ||
} | ||
|
||
class MailerWrapperTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @throws \ByJG\Mail\Exception\InvalidMailHandlerException | ||
*/ | ||
public function testRegisterMailer() | ||
{ | ||
MailerFactory::registerMailer('smtp', PHPMailerWrapper::class); | ||
MailerFactory::registerMailer('tls', PHPMailerWrapper::class); | ||
MailerFactory::registerMailer('ssl', PHPMailerWrapper::class); | ||
MailerFactory::registerMailer('sendmail', SendMailWrapper::class); | ||
MailerFactory::registerMailer('mailgun', MailgunApiWrapper::class); | ||
MailerFactory::registerMailer('ses', AmazonSesWrapper::class); | ||
} | ||
|
||
/** | ||
* @throws \ByJG\Mail\Exception\InvalidMailHandlerException | ||
* @expectedException \ByJG\Mail\Exception\InvalidMailHandlerException | ||
*/ | ||
public function testRegisterMailerFail() | ||
{ | ||
MailerFactory::registerMailer('some', '\\Non\\Existant\\Class'); | ||
} | ||
|
||
/** | ||
* @throws \ByJG\Mail\Exception\InvalidMailHandlerException | ||
* @throws \ByJG\Mail\Exception\ProtocolNotRegisteredException | ||
*/ | ||
public function testCreate() | ||
{ | ||
MailerFactory::registerMailer('smtp', PHPMailerWrapper::class); | ||
MailerFactory::create('smtp://localhost'); | ||
} | ||
|
||
/** | ||
* @throws \ByJG\Mail\Exception\ProtocolNotRegisteredException | ||
* @expectedException \ByJG\Mail\Exception\ProtocolNotRegisteredException | ||
* @throws \ByJG\Mail\Exception\InvalidMailHandlerException | ||
*/ | ||
public function testCreateFail() | ||
{ | ||
MailerFactory::registerMailer('smtp', PHPMailerWrapper::class); | ||
MailerFactory::create('some://localhost'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters