1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2013 |
6
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2022 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
namespace Aimeos\Base\Mail\Message; |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
class Typo3Test extends \PHPUnit\Framework\TestCase |
14
|
|
|
{ |
15
|
|
|
private $object; |
16
|
|
|
private $mock; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
protected function setUp() : void |
20
|
|
|
{ |
21
|
|
|
if( !class_exists( 'TYPO3\\CMS\\Core\\Mail\\MailMessage' ) ) { |
22
|
|
|
$this->markTestSkipped( 'Class TYPO3\\CMS\\Core\\Mail\\MailMessage not found' ); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
$this->mock = $this->getMockBuilder( 'TYPO3\\CMS\\Core\\Mail\\MailMessage' ) |
26
|
|
|
->disableOriginalConstructor() |
27
|
|
|
->getMock(); |
28
|
|
|
|
29
|
|
|
$this->object = new \Aimeos\Base\Mail\Message\Typo3( $this->mock, 'UTF-8' ); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
protected function tearDown() : void |
34
|
|
|
{ |
35
|
|
|
unset( $this->object, $this->mock ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function testFrom() |
40
|
|
|
{ |
41
|
|
|
$this->mock->expects( $this->once() )->method( 'addFrom' ); |
42
|
|
|
|
43
|
|
|
$result = $this->object->from( 'a@b', 'test' ); |
44
|
|
|
$this->assertSame( $this->object, $result ); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
public function testTo() |
49
|
|
|
{ |
50
|
|
|
$this->mock->expects( $this->once() )->method( 'addTo' ); |
51
|
|
|
|
52
|
|
|
$result = $this->object->to( 'a@b', 'test' ); |
53
|
|
|
$this->assertSame( $this->object, $result ); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
public function testCc() |
58
|
|
|
{ |
59
|
|
|
$this->mock->expects( $this->once() )->method( 'addCc' ); |
60
|
|
|
|
61
|
|
|
$result = $this->object->cc( 'a@b', 'test' ); |
62
|
|
|
$this->assertSame( $this->object, $result ); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
public function testBcc() |
67
|
|
|
{ |
68
|
|
|
$this->mock->expects( $this->once() )->method( 'addBcc' ); |
69
|
|
|
|
70
|
|
|
$result = $this->object->bcc( 'a@b', 'test' ); |
71
|
|
|
$this->assertSame( $this->object, $result ); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
public function testReplyTo() |
76
|
|
|
{ |
77
|
|
|
$this->mock->expects( $this->once() )->method( 'addReplyTo' ); |
78
|
|
|
|
79
|
|
|
$result = $this->object->replyTo( 'a@b', 'test' ); |
80
|
|
|
$this->assertSame( $this->object, $result ); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
|
84
|
|
|
public function testSend() |
85
|
|
|
{ |
86
|
|
|
$this->mock->expects( $this->once() )->method( 'send' ); |
87
|
|
|
$this->assertSame( $this->object, $this->object->send() ); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
91
|
|
|
public function testSender() |
92
|
|
|
{ |
93
|
|
|
$this->mock->expects( $this->once() )->method( 'setSender' ); |
94
|
|
|
|
95
|
|
|
$result = $this->object->sender( 'a@b', 'test' ); |
96
|
|
|
$this->assertSame( $this->object, $result ); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
|
100
|
|
|
public function testSubject() |
101
|
|
|
{ |
102
|
|
|
$this->mock->expects( $this->once() )->method( 'setSubject' ) |
103
|
|
|
->with( $this->stringContains( 'test' ) ); |
104
|
|
|
|
105
|
|
|
$result = $this->object->subject( 'test' ); |
106
|
|
|
$this->assertSame( $this->object, $result ); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
public function testText() |
111
|
|
|
{ |
112
|
|
|
$this->mock->expects( $this->once() )->method( 'text' ) |
113
|
|
|
->with( $this->stringContains( 'test' ) ); |
114
|
|
|
|
115
|
|
|
$result = $this->object->text( 'test' ); |
116
|
|
|
$this->assertSame( $this->object, $result ); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
|
120
|
|
|
public function testHtml() |
121
|
|
|
{ |
122
|
|
|
$this->mock->expects( $this->once() )->method( 'html' ) |
123
|
|
|
->with( $this->stringContains( 'test' ) ); |
124
|
|
|
|
125
|
|
|
$result = $this->object->html( 'test' ); |
126
|
|
|
$this->assertSame( $this->object, $result ); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
public function testAttach() |
131
|
|
|
{ |
132
|
|
|
$this->markTestIncomplete( 'Swift_Attachment::newInstance() is not testable' ); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
|
136
|
|
|
public function testEmbed() |
137
|
|
|
{ |
138
|
|
|
$this->markTestIncomplete( 'Swift_EmbeddedFile::newInstance() is not testable' ); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
public function testObject() |
143
|
|
|
{ |
144
|
|
|
$this->assertInstanceOf( 'TYPO3\\CMS\\Core\\Mail\\MailMessage', $this->object->object() ); |
145
|
|
|
} |
146
|
|
|
} |
147
|
|
|
|