]> git.mxchange.org Git - friendica.git/blob - tests/src/Util/Emailer/SystemMailBuilderTest.php
Merge pull request #8237 from annando/a11y-2
[friendica.git] / tests / src / Util / Emailer / SystemMailBuilderTest.php
1 <?php
2
3 namespace Friendica\Test\src\Util\Emailer;
4
5 use Friendica\App\BaseURL;
6 use Friendica\Core\Config\IConfig;
7 use Friendica\Core\L10n;
8 use Friendica\Test\MockedTest;
9 use Friendica\Test\Util\VFSTrait;
10 use Friendica\Util\EMailer\MailBuilder;
11 use Friendica\Util\EMailer\SystemMailBuilder;
12 use Psr\Log\NullLogger;
13
14 class SystemMailBuilderTest extends MockedTest
15 {
16         use VFSTrait;
17
18         /** @var IConfig */
19         private $config;
20         /** @var L10n */
21         private $l10n;
22         /** @var BaseURL */
23         private $baseUrl;
24
25         /** @var string */
26         private $defaultHeaders;
27
28         public function setUp()
29         {
30                 parent::setUp();
31
32                 $this->setUpVfsDir();
33
34                 $this->config  = \Mockery::mock(IConfig::class);
35                 $this->config->shouldReceive('get')->with('config', 'admin_name')->andReturn('Admin');
36                 $this->l10n    = \Mockery::mock(L10n::class);
37                 $this->l10n->shouldReceive('t')->andReturnUsing(function ($msg) {
38                         return $msg;
39                 });
40                 $this->baseUrl = \Mockery::mock(BaseURL::class);
41                 $this->baseUrl->shouldReceive('getHostname')->andReturn('friendica.local');
42                 $this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local');
43
44                 $this->defaultHeaders = "";
45         }
46
47         /**
48          * Test if the builder instance can get created
49          */
50         public function testBuilderInstance()
51         {
52                 $builder = new SystemMailBuilder($this->l10n, $this->baseUrl, $this->config, new NullLogger(), 'moreply@friendica.local', 'FriendicaSite');
53
54                 $this->assertInstanceOf(MailBuilder::class, $builder);
55                 $this->assertInstanceOf(SystemMailBuilder::class, $builder);
56         }
57 }