1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace FH\Bundle\MailerBundle\Tests\Email; |
6
|
|
|
|
7
|
|
|
use FH\Bundle\MailerBundle\Email\Participants; |
8
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @covers \FH\Bundle\MailerBundle\Email\Participants |
12
|
|
|
*/ |
13
|
|
|
final class ParticipantsOptionsTest extends TestCase |
14
|
|
|
{ |
15
|
|
|
/** @var Participants */ |
16
|
|
|
private $participants; |
17
|
|
|
|
18
|
|
|
protected function setUp(): void |
19
|
|
|
{ |
20
|
|
|
$this->participants = Participants::fromArray([ |
21
|
|
|
'sender' => [ |
22
|
|
|
'name' => 'Mr. Test', |
23
|
|
|
'address' => '[email protected]', |
24
|
|
|
], |
25
|
|
|
'from' => [ |
26
|
|
|
[ |
27
|
|
|
'name' => 'Mr. Test', |
28
|
|
|
'address' => '[email protected]', |
29
|
|
|
], |
30
|
|
|
], |
31
|
|
|
'reply_to' => [ |
32
|
|
|
[ |
33
|
|
|
'name' => 'Mr. Test', |
34
|
|
|
'address' => '[email protected]', |
35
|
|
|
], |
36
|
|
|
], |
37
|
|
|
'to' => [ |
38
|
|
|
[ |
39
|
|
|
'name' => 'Ms. Test', |
40
|
|
|
'address' => '[email protected]', |
41
|
|
|
], |
42
|
|
|
[ |
43
|
|
|
'name' => 'Test Junior', |
44
|
|
|
'address' => '[email protected]', |
45
|
|
|
], |
46
|
|
|
], |
47
|
|
|
'cc' => [ |
48
|
|
|
[ |
49
|
|
|
'name' => 'Ms. Test', |
50
|
|
|
'address' => '[email protected]', |
51
|
|
|
], |
52
|
|
|
], |
53
|
|
|
'bcc' => [ |
54
|
|
|
[ |
55
|
|
|
'name' => 'Ms. Test', |
56
|
|
|
'address' => '[email protected]', |
57
|
|
|
], |
58
|
|
|
], |
59
|
|
|
]); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function testFromArray(): void |
63
|
|
|
{ |
64
|
|
|
// Sender |
65
|
|
|
$this->assertTrue($this->participants->hasSender()); |
66
|
|
|
$this->assertSame('Mr. Test', $this->participants->getSender()->getName()); |
67
|
|
|
$this->assertSame('[email protected]', $this->participants->getSender()->getAddress()); |
68
|
|
|
|
69
|
|
|
// From |
70
|
|
|
$this->assertTrue($this->participants->hasFrom()); |
71
|
|
|
$this->assertCount(1, $this->participants->getFrom()); |
72
|
|
|
$this->assertSame('Mr. Test', $this->participants->getFrom()[0]->getName()); |
73
|
|
|
$this->assertSame('[email protected]', $this->participants->getFrom()[0]->getAddress()); |
74
|
|
|
|
75
|
|
|
// Reply to |
76
|
|
|
$this->assertTrue($this->participants->hasReplyTo()); |
77
|
|
|
$this->assertCount(1, $this->participants->getReplyTo()); |
78
|
|
|
$this->assertSame('Mr. Test', $this->participants->getReplyTo()[0]->getName()); |
79
|
|
|
$this->assertSame('[email protected]', $this->participants->getReplyTo()[0]->getAddress()); |
80
|
|
|
|
81
|
|
|
// To |
82
|
|
|
$this->assertTrue($this->participants->hasTo()); |
83
|
|
|
$this->assertCount(2, $this->participants->getTo()); |
84
|
|
|
$this->assertSame('Ms. Test', $this->participants->getTo()[0]->getName()); |
85
|
|
|
$this->assertSame('[email protected]', $this->participants->getFrom()[0]->getAddress()); |
86
|
|
|
$this->assertSame('Test Junior', $this->participants->getTo()[1]->getName()); |
87
|
|
|
$this->assertSame('[email protected]', $this->participants->getTo()[1]->getAddress()); |
88
|
|
|
|
89
|
|
|
// Cc |
90
|
|
|
$this->assertTrue($this->participants->hasCc()); |
91
|
|
|
$this->assertCount(1, $this->participants->getCc()); |
92
|
|
|
$this->assertSame('Ms. Test', $this->participants->getCc()[0]->getName()); |
93
|
|
|
$this->assertSame('[email protected]', $this->participants->getCc()[0]->getAddress()); |
94
|
|
|
|
95
|
|
|
// Bcc |
96
|
|
|
$this->assertTrue($this->participants->hasBcc()); |
97
|
|
|
$this->assertCount(1, $this->participants->getBcc()); |
98
|
|
|
$this->assertSame('Ms. Test', $this->participants->getBcc()[0]->getName()); |
99
|
|
|
$this->assertSame('[email protected]', $this->participants->getBcc()[0]->getAddress()); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths