Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

47 lines
1.5KB

  1. <?php
  2. /**
  3. * Base test for smoke tests.
  4. *
  5. * @author Rouven Weßling
  6. */
  7. class SwiftMailerSmokeTestCase extends SwiftMailerTestCase
  8. {
  9. public function setUp()
  10. {
  11. if (!defined('SWIFT_SMOKE_TRANSPORT_TYPE')) {
  12. $this->markTestSkipped(
  13. 'Smoke tests are skipped if tests/smoke.conf.php is not edited'
  14. );
  15. }
  16. }
  17. protected function _getMailer()
  18. {
  19. switch (SWIFT_SMOKE_TRANSPORT_TYPE) {
  20. case 'smtp':
  21. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.smtp')
  22. ->setHost(SWIFT_SMOKE_SMTP_HOST)
  23. ->setPort(SWIFT_SMOKE_SMTP_PORT)
  24. ->setUsername(SWIFT_SMOKE_SMTP_USER)
  25. ->setPassword(SWIFT_SMOKE_SMTP_PASS)
  26. ->setEncryption(SWIFT_SMOKE_SMTP_ENCRYPTION)
  27. ;
  28. break;
  29. case 'sendmail':
  30. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.sendmail')
  31. ->setCommand(SWIFT_SMOKE_SENDMAIL_COMMAND)
  32. ;
  33. break;
  34. case 'mail':
  35. case 'nativemail':
  36. $transport = Swift_DependencyContainer::getInstance()->lookup('transport.mail');
  37. break;
  38. default:
  39. throw new Exception('Undefined transport ['.SWIFT_SMOKE_TRANSPORT_TYPE.']');
  40. }
  41. return new Swift_Mailer($transport);
  42. }
  43. }