summaryrefslogtreecommitdiff
path: root/tests/units/Helper/MailHelperTest.php
blob: 26152a69faf8d32c9366dd3e18501de0922c55f3 (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
<?php

require_once __DIR__.'/../Base.php';

use Kanboard\Helper\MailHelper;

class MailHelperTest extends Base
{
    public function testFilterSubject()
    {
        $helper = new MailHelper($this->container);
        $this->assertEquals('Test', $helper->filterSubject('Test'));
        $this->assertEquals('Test', $helper->filterSubject('RE: Test'));
        $this->assertEquals('Test', $helper->filterSubject('FW: Test'));
        $this->assertEquals('Test', $helper->filterSubject('Fwd: Test'));
    }

    public function testGetSenderAddress()
    {
        $helper = new MailHelper($this->container);
        $this->assertEquals('notifications@kanboard.local', $helper->getMailSenderAddress());

        $this->container['configModel']->save(array('mail_sender_address' => 'me@here'));
        $this->container['memoryCache']->flush();

        $this->assertEquals('me@here', $helper->getMailSenderAddress());
    }

    public function testGetTransport()
    {
        $helper = new MailHelper($this->container);
        $this->assertEquals(MAIL_TRANSPORT, $helper->getMailTransport());

        $this->container['configModel']->save(array('mail_transport' => 'smtp'));
        $this->container['memoryCache']->flush();

        $this->assertEquals('smtp', $helper->getMailTransport());
    }
}