TransportChangeEventTest.php 931B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. require_once 'Swift/Tests/SwiftUnitTestCase.php';
  3. require_once 'Swift/Events/TransportChangeEvent.php';
  4. require_once 'Swift/Transport.php';
  5. class Swift_Events_TransportChangeEventTest extends Swift_Tests_SwiftUnitTestCase
  6. {
  7. public function testGetTransportReturnsTransport()
  8. {
  9. $transport = $this->_createTransport();
  10. $evt = $this->_createEvent($transport);
  11. $ref = $evt->getTransport();
  12. $this->assertReference($transport, $ref);
  13. }
  14. public function testSourceIsTransport()
  15. {
  16. $transport = $this->_createTransport();
  17. $evt = $this->_createEvent($transport);
  18. $ref = $evt->getSource();
  19. $this->assertReference($transport, $ref);
  20. }
  21. // -- Creation Methods
  22. private function _createEvent(Swift_Transport $source)
  23. {
  24. return new Swift_Events_TransportChangeEvent($source);
  25. }
  26. private function _createTransport()
  27. {
  28. return $this->_stub('Swift_Transport');
  29. }
  30. }