88use Magento \Backend \App \Area \FrontNameResolver as BackendFrontNameResolver ;
99use Magento \Framework \App \Area ;
1010use Magento \Framework \App \Filesystem \DirectoryList ;
11- use Magento \Framework \App \ObjectManager ;
1211use Magento \Framework \App \TemplateTypesInterface ;
12+ use Magento \Framework \ObjectManagerInterface ;
1313use Magento \Framework \View \DesignInterface ;
1414use Magento \Store \Model \ScopeInterface ;
1515use Magento \Store \Model \Store ;
@@ -26,12 +26,7 @@ class TemplateTest extends \PHPUnit\Framework\TestCase
2626 protected $ model ;
2727
2828 /**
29- * @var \Zend_Mail|\PHPUnit\Framework\MockObject\MockObject
30- */
31- protected $ mail ;
32-
33- /**
34- * @var \Magento\Framework\ObjectManagerInterface
29+ * @var ObjectManagerInterface
3530 */
3631 protected $ objectManager ;
3732
@@ -46,13 +41,8 @@ protected function mockModel($filesystem = null)
4641 $ filesystem = $ this ->objectManager ->create (\Magento \Framework \Filesystem::class);
4742 }
4843
49- $ this ->mail = $ this ->getMockBuilder (\Zend_Mail::class)
50- ->setMethods (['send ' , 'addTo ' , 'addBcc ' , 'setReturnPath ' , 'setReplyTo ' ])
51- ->setConstructorArgs (['utf-8 ' ])
52- ->getMock ();
53-
5444 $ this ->model = $ this ->getMockBuilder (\Magento \Email \Model \Template::class)
55- ->setMethods ([ ' _getMail ' ])
45+ ->addMethods ([ ])
5646 ->setConstructorArgs (
5747 [
5848 $ this ->objectManager ->get (\Magento \Framework \Model \Context::class),
@@ -73,25 +63,13 @@ protected function mockModel($filesystem = null)
7363 ->getMock ();
7464
7565 $ this ->objectManager ->get (\Magento \Framework \App \State::class)->setAreaCode ('frontend ' );
76-
77- $ this ->model ->expects ($ this ->any ())->method ('_getMail ' )->willReturnCallback ([$ this , 'getMail ' ]);
7866 $ this ->model
7967 ->setSenderName ('sender ' )
8068 ->setSenderEmail ('sender@example.com ' )
8169 ->setTemplateSubject ('Subject ' )
8270 ->setTemplateId ('abc ' );
8371 }
8472
85- /**
86- * Return a disposable \Zend_Mail instance
87- *
88- * @return \PHPUnit\Framework\MockObject\MockObject|\Zend_Mail
89- */
90- public function getMail ()
91- {
92- return clone $ this ->mail ;
93- }
94-
9573 public function testSetGetTemplateFilter ()
9674 {
9775 $ this ->mockModel ();
0 commit comments