1<?php
2
3/**
4 * @group smoke
5 */
6class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase
7{
8    private $_attFile;
9
10    protected function setUp()
11    {
12        $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
13    }
14
15    public function testAttachmentSending()
16    {
17        $mailer = $this->_getMailer();
18        $message = Swift_Message::newInstance('[Swift Mailer] HtmlWithAttachmentSmokeTest')
19            ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))
20            ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
21            ->attach(Swift_Attachment::fromPath($this->_attFile))
22            ->setBody('<p>This HTML-formatted message should contain an attached ZIP file (named "textfile.zip").'.PHP_EOL.
23                'When unzipped, the archive should produce a text file which reads:</p>'.PHP_EOL.
24                '<p><q>This is part of a Swift Mailer v4 smoke test.</q></p>', 'text/html'
25            )
26            ;
27        $this->assertEquals(1, $mailer->send($message),
28            '%s: The smoke test should send a single message'
29            );
30    }
31}
32