InternationalSmokeTest.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. require_once 'Swift/Tests/SwiftSmokeTestCase.php';
  3. class Swift_Smoke_InternationalSmokeTest extends Swift_Tests_SwiftSmokeTestCase
  4. {
  5. public function setUp()
  6. {
  7. $this->_attFile = dirname(__FILE__) . '/../../../_samples/files/textfile.zip';
  8. }
  9. public function testAttachmentSending()
  10. {
  11. $mailer = $this->_getMailer();
  12. $message = Swift_Message::newInstance()
  13. ->setCharset('utf-8')
  14. ->setSubject('[Swift Mailer] InternationalSmokeTest (διεθνής)')
  15. ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Χριστοφορου (Swift Mailer)'))
  16. ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
  17. ->setBody('This message should contain an attached ZIP file (named "κείμενο, εδάφιο, θέμα.zip").' . PHP_EOL .
  18. 'When unzipped, the archive should produce a text file which reads:' . PHP_EOL .
  19. '"This is part of a Swift Mailer v4 smoke test."' . PHP_EOL .
  20. PHP_EOL .
  21. 'Following is some arbitrary Greek text:' . PHP_EOL .
  22. 'Δεν βρέθηκαν λέξεις.'
  23. )
  24. ->attach(Swift_Attachment::fromPath($this->_attFile)
  25. ->setContentType('application/zip')
  26. ->setFilename('κείμενο, εδάφιο, θέμα.zip')
  27. )
  28. ;
  29. $this->assertEqual(1, $mailer->send($message),
  30. '%s: The smoke test should send a single message'
  31. );
  32. $this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/international.jpg');
  33. }
  34. }