|
144 | 144 | expect($message->attachments())->toBe([]); |
145 | 145 | }); |
146 | 146 |
|
147 | | -test('it can parse other header fields like IN-REPLY-TO', function () { |
| 147 | +test('it can parse In-Reply-To header', function () { |
148 | 148 | $contents = <<<'EOT' |
149 | 149 | From: "John Doe" <[email protected]> |
150 | | - |
| 150 | + |
151 | 151 | Subject: In-Reply-To Check |
152 | 152 | Date: Wed, 19 Feb 2025 12:34:56 -0500 |
153 | 153 | Content-Type: text/plain; charset="UTF-8" |
|
157 | 157 |
|
158 | 158 | $message = new FileMessage($contents); |
159 | 159 |
|
160 | | - $address = $message->inReplyTo(); |
161 | | - expect($address)->not->toBeNull(); |
162 | | - expect( $address-> email())-> toBe( '[email protected]'); |
| 160 | + expect( $message-> inReplyTo())-> toBe([ '[email protected]']); |
| 161 | +}); |
| 162 | + |
| 163 | +test('it can parse In-Reply-To header with multiple values', function () { |
| 164 | + $contents = <<<'EOT' |
| 165 | + From: "John Doe" <[email protected]> |
| 166 | + |
| 167 | + Subject: In-Reply-To Check |
| 168 | + Date: Wed, 19 Feb 2025 12:34:56 -0500 |
| 169 | + Content-Type: text/plain; charset="UTF-8" |
| 170 | +
|
| 171 | + Check the in-reply-to header |
| 172 | + EOT; |
| 173 | + |
| 174 | + $message = new FileMessage($contents); |
| 175 | + |
| 176 | + expect($message->inReplyTo())->toBe([ |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + ]); |
| 181 | +}); |
| 182 | + |
| 183 | +test('it returns empty array when In-Reply-To header is missing', function () { |
| 184 | + $contents = <<<'EOT' |
| 185 | + From: "John Doe" <[email protected]> |
| 186 | + Subject: No In-Reply-To |
| 187 | + Date: Wed, 19 Feb 2025 12:34:56 -0500 |
| 188 | + Content-Type: text/plain; charset="UTF-8" |
| 189 | +
|
| 190 | + No in-reply-to header |
| 191 | + EOT; |
| 192 | + |
| 193 | + $message = new FileMessage($contents); |
| 194 | + |
| 195 | + expect($message->inReplyTo())->toBe([]); |
163 | 196 | }); |
164 | 197 |
|
165 | 198 | test('it can be cast to a string via __toString()', function () { |
|
0 commit comments