Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HtmlReportEmailGeneratorTest.php « ReportEmailGenerator « Integration « tests « ScheduledReports « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 357306d6d3254adfd67c9b8289efc3732ffb38d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */

namespace Piwik\Plugins\ScheduledReports\tests\Integration\ReportEmailGenerator;

use Piwik\Plugins\ScheduledReports\GeneratedReport;
use Piwik\Plugins\ScheduledReports\ReportEmailGenerator\HtmlReportEmailGenerator;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Zend_Mime;

class HtmlReportEmailGeneratorTest extends IntegrationTestCase
{
    /**
     * @var HtmlReportEmailGenerator
     */
    private $testInstance;

    public function setUp()
    {
        parent::setUp();
        $this->testInstance = new HtmlReportEmailGenerator();
    }

    public function test_makeEmail_ReturnsCorrectlyConfiguredEmailInstance()
    {
        $reportDetails = [
            'format' => 'html',
        ];

        $generatedReport = new GeneratedReport(
            $reportDetails,
            'report',
            'pretty date',
            'report contents',
            []
        );

        $mail = $this->testInstance->makeEmail($generatedReport);

        $this->assertEquals('General_Report report - pretty date', $mail->getSubject());
        $this->assertEquals(Zend_Mime::MULTIPART_RELATED, $mail->getType());
        $this->assertEquals('report contents', $mail->getBodyHtml()->getContent());
        $this->assertEquals('Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
', $mail->getBodyHtml()->getHeaders());
    }
}