Skip to content

Commit 15749a7

Browse files
ENGCOM-6240: fix for Issue #25434 Mail address email constructor argument type inc… #25485
2 parents a434f2e + 06bf4bf commit 15749a7

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

lib/internal/Magento/Framework/Mail/Address.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\Framework\Mail;
99

1010
/**
11-
* Class MailAddress
11+
* Class Address
1212
*/
1313
class Address
1414
{
@@ -23,7 +23,7 @@ class Address
2323
private $email;
2424

2525
/**
26-
* MailAddress constructor
26+
* Address constructor
2727
*
2828
* @param string|null $email
2929
* @param string|null $name
@@ -49,9 +49,9 @@ public function getName(): ?string
4949
/**
5050
* Email getter
5151
*
52-
* @return string
52+
* @return string|null
5353
*/
54-
public function getEmail(): string
54+
public function getEmail(): ?string
5555
{
5656
return $this->email;
5757
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\Mail\Test\Unit;
7+
8+
use Magento\Framework\Mail\Address;
9+
use PHPUnit\Framework\TestCase;
10+
11+
/**
12+
* test Magento\Framework\Mail\Address
13+
*/
14+
class AddressTest extends TestCase
15+
{
16+
/**
17+
* @var Address
18+
*/
19+
protected $message;
20+
21+
/**
22+
* Address object with nullable email parameter passed should not throw an exception.
23+
*
24+
* @return void
25+
*/
26+
public function testGetEmailEmpty()
27+
{
28+
$address = new Address(null, "Test name");
29+
$this->assertNull($address->getEmail());
30+
}
31+
}

0 commit comments

Comments
 (0)