summaryrefslogtreecommitdiff
path: root/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php')
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
new file mode 100644
index 0000000..731dfad
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
@@ -0,0 +1,41 @@
+<?php
+
+class Swift_Events_TransportExceptionEventTest extends \PHPUnit_Framework_TestCase
+{
+ public function testExceptionCanBeFetchViaGetter()
+ {
+ $ex = $this->_createException();
+ $transport = $this->_createTransport();
+ $evt = $this->_createEvent($transport, $ex);
+ $ref = $evt->getException();
+ $this->assertEquals($ex, $ref,
+ '%s: Exception should be available via getException()'
+ );
+ }
+
+ public function testSourceIsTransport()
+ {
+ $ex = $this->_createException();
+ $transport = $this->_createTransport();
+ $evt = $this->_createEvent($transport, $ex);
+ $ref = $evt->getSource();
+ $this->assertEquals($transport, $ref,
+ '%s: Transport should be available via getSource()'
+ );
+ }
+
+ private function _createEvent(Swift_Transport $transport, Swift_TransportException $ex)
+ {
+ return new Swift_Events_TransportExceptionEvent($transport, $ex);
+ }
+
+ private function _createTransport()
+ {
+ return $this->getMockBuilder('Swift_Transport')->getMock();
+ }
+
+ private function _createException()
+ {
+ return new Swift_TransportException('');
+ }
+}