|
2 | 2 |
|
3 | 3 | namespace Tests;
|
4 | 4 |
|
| 5 | +use Illuminate\Mail\Mailables\Address; |
| 6 | + |
5 | 7 | class EncryptionTest extends TestCase
|
6 | 8 | {
|
7 | 9 | public function setUp(): void
|
@@ -52,10 +54,29 @@ public function reply_to_should_be_encrypted_and_decrypted()
|
52 | 54 | $email = $this->sendEmail([
|
53 | 55 | 'reply_to' => $replyTo = ['john+1@doe.com', 'john+2@doe.com'],
|
54 | 56 | ]);
|
55 |
| - |
56 | 57 | $this->assertEquals($replyTo, decrypt($email->getRawDatabaseValue('reply_to')));
|
57 |
| - |
58 | 58 | $this->assertEquals($replyTo, $email->getReplyTo());
|
| 59 | + |
| 60 | + if (! class_exists(Address::class)) { |
| 61 | + return; |
| 62 | + } |
| 63 | + |
| 64 | + // Test with a single Address object... |
| 65 | + $email = $this->sendEmail([ |
| 66 | + 'reply_to' => new Address('john+1@doe.com', 'John Doe'), |
| 67 | + ]); |
| 68 | + $this->assertEquals([['address' => 'john+1@doe.com', 'name' => 'John Doe']], decrypt($email->getRawDatabaseValue('reply_to'))); |
| 69 | + $this->assertEquals([['address' => 'john+1@doe.com', 'name' => 'John Doe']], $email->getReplyTo()); |
| 70 | + |
| 71 | + // Address with an array of Address objects... |
| 72 | + $email = $this->sendEmail([ |
| 73 | + 'reply_to' => [ |
| 74 | + new Address('john+1@doe.com', 'John Doe'), |
| 75 | + new Address('jane+1@doe.com', 'Jane Doe'), |
| 76 | + ], |
| 77 | + ]); |
| 78 | + $this->assertSame([['address' => 'john+1@doe.com', 'name' => 'John Doe'], ['address' => 'jane+1@doe.com', 'name' => 'Jane Doe']], decrypt($email->getRawDatabaseValue('reply_to'))); |
| 79 | + $this->assertSame([['address' => 'john+1@doe.com', 'name' => 'John Doe'], ['address' => 'jane+1@doe.com', 'name' => 'Jane Doe']], $email->getReplyTo()); |
59 | 80 | }
|
60 | 81 |
|
61 | 82 | /** @test */
|
|
0 commit comments