File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function setReturnPath(string $address): static
9292
9393 public function getReturnPath (): string
9494 {
95- return $ this ->message ->getReturnPath ();
95+ return $ this ->message ->getReturnPath ()?->toString() ?? '' ;
9696 }
9797
9898 /**
Original file line number Diff line number Diff line change 1414use PHPUnit \Framework \TestCase ;
1515use Symfony \Bridge \Twig \Mime \BodyRenderer ;
1616use Symfony \Bridge \Twig \Mime \TemplatedEmail ;
17+ use Symfony \Bridge \Twig \Mime \WrappedTemplatedEmail ;
1718use Twig \Environment ;
1819use Twig \Loader \FilesystemLoader ;
1920
@@ -99,4 +100,22 @@ private function buildEmail(string $template): TemplatedEmail
99100
100101 return $ email ;
101102 }
103+
104+ public function testGetReturnPathWhenNull (): void
105+ {
106+ $ twig = $ this ->createMock (Environment::class);
107+ $ message = new TemplatedEmail ();
108+ $ email = new WrappedTemplatedEmail ($ twig , $ message );
109+
110+ $ this ->assertSame ('' , $ email ->getReturnPath ());
111+ }
112+
113+ public function testGetReturnPathWhenSet (): void
114+ {
115+ $ twig = $ this ->createMock (Environment::class);
116+ $ message = (new TemplatedEmail ())->returnPath ('test@example.com ' );
117+ $ email = new WrappedTemplatedEmail ($ twig , $ message );
118+
119+ $ this ->assertSame ('test@example.com ' , $ email ->getReturnPath ());
120+ }
102121}
You can’t perform that action at this time.
0 commit comments