7
7
namespace Magento \Framework \Mail \Test \Unit \Template ;
8
8
9
9
use Magento \Framework \App \TemplateTypesInterface ;
10
- use Magento \Framework \DataObject ;
11
10
use Magento \Framework \Mail \MessageInterface ;
12
11
13
12
/**
@@ -100,37 +99,17 @@ protected function setUp()
100
99
*/
101
100
public function testGetTransport ($ templateType , $ messageType , $ bodyText , $ templateNamespace )
102
101
{
102
+ $ this ->builder ->setTemplateModel ($ templateNamespace );
103
+
103
104
$ vars = ['reason ' => 'Reason ' , 'customer ' => 'Customer ' ];
104
105
$ options = ['area ' => 'frontend ' , 'store ' => 1 ];
105
- $ from = 'email_from ' ;
106
- $ sender = [
'email ' =>
'[email protected] ' ,
'name ' =>
'name ' ];
107
-
108
- $ this ->builder ->setTemplateModel ($ templateNamespace );
109
- $ this ->builder ->setFrom ($ from );
110
106
111
- $ template = $ this ->createPartialMock (
112
- \Magento \Framework \Mail \TemplateInterface::class,
113
- [
114
- 'setVars ' ,
115
- 'isPlain ' ,
116
- 'setOptions ' ,
117
- 'getSubject ' ,
118
- 'getType ' ,
119
- 'processTemplate ' ,
120
- 'getDesignConfig ' ,
121
- ]
122
- );
107
+ $ template = $ this ->createMock (\Magento \Framework \Mail \TemplateInterface::class);
123
108
$ template ->expects ($ this ->once ())->method ('setVars ' )->with ($ this ->equalTo ($ vars ))->willReturnSelf ();
124
109
$ template ->expects ($ this ->once ())->method ('setOptions ' )->with ($ this ->equalTo ($ options ))->willReturnSelf ();
125
110
$ template ->expects ($ this ->once ())->method ('getSubject ' )->willReturn ('Email Subject ' );
126
111
$ template ->expects ($ this ->once ())->method ('getType ' )->willReturn ($ templateType );
127
112
$ template ->expects ($ this ->once ())->method ('processTemplate ' )->willReturn ($ bodyText );
128
- $ template ->method ('getDesignConfig ' )->willReturn (new DataObject ($ options ));
129
-
130
- $ this ->senderResolverMock ->expects ($ this ->once ())
131
- ->method ('resolve ' )
132
- ->with ($ from , 1 )
133
- ->willReturn ($ sender );
134
113
135
114
$ this ->templateFactoryMock ->expects ($ this ->once ())
136
115
->method ('get ' )
@@ -149,9 +128,6 @@ public function testGetTransport($templateType, $messageType, $bodyText, $templa
149
128
->method ('setBody ' )
150
129
->with ($ this ->equalTo ($ bodyText ))
151
130
->willReturnSelf ();
152
- $ this ->messageMock ->method ('setFrom ' )
153
- ->with ($ sender ['email ' ], $ sender ['name ' ])
154
- ->willReturnSelf ();
155
131
156
132
$ transport = $ this ->createMock (\Magento \Framework \Mail \TransportInterface::class);
157
133
@@ -184,7 +160,7 @@ public function getTransportDataProvider()
184
160
]
185
161
];
186
162
}
187
-
163
+
188
164
/**
189
165
* @return void
190
166
*/
0 commit comments