SwiftSmokeTestCase.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once 'Swift/Tests/SwiftUnitTestCase.php';
  3. require_once 'swift_required.php';
  4. /**
  5. * Smoke test helper class.
  6. * @package Swift
  7. * @subpackage Tests
  8. * @author Chris Corbyn
  9. */
  10. class Swift_Tests_SwiftSmokeTestCase extends Swift_Tests_SwiftUnitTestCase
  11. {
  12. public function skip()
  13. {
  14. $this->skipUnless(SWIFT_SMOKE_TRANSPORT_TYPE,
  15. '%s: Smoke tests are skipped if tests/smoke.conf.php is not editted'
  16. );
  17. }
  18. protected function _getMailer()
  19. {
  20. switch (SWIFT_SMOKE_TRANSPORT_TYPE)
  21. {
  22. case 'smtp':
  23. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.smtp')
  24. ->setHost(SWIFT_SMOKE_SMTP_HOST)
  25. ->setPort(SWIFT_SMOKE_SMTP_PORT)
  26. ->setUsername(SWIFT_SMOKE_SMTP_USER)
  27. ->setPassword(SWIFT_SMOKE_SMTP_PASS)
  28. ->setEncryption(SWIFT_SMOKE_SMTP_ENCRYPTION)
  29. ;
  30. break;
  31. case 'sendmail':
  32. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.sendmail')
  33. ->setCommand(SWIFT_SMOKE_SENDMAIL_COMMAND)
  34. ;
  35. break;
  36. case 'mail':
  37. case 'nativemail':
  38. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.mail');
  39. break;
  40. default:
  41. throw new Exception('Undefined transport [' . SWIFT_SMOKE_TRANSPORT_TYPE . ']');
  42. }
  43. return new Swift_Mailer($transport);
  44. }
  45. protected function _visualCheck($url)
  46. {
  47. $this->dump('{image @ ' . $url . '}');
  48. }
  49. }