@@ -173,23 +173,25 @@ protected function getModelMock(array $mockedMethods = [])
173
173
{
174
174
return $ this ->getMockBuilder (Template::class)
175
175
->setMethods (array_merge ($ mockedMethods , ['__wakeup ' , '__sleep ' , '_init ' ]))
176
- ->setConstructorArgs ([
177
- $ this ->context ,
178
- $ this ->design ,
179
- $ this ->registry ,
180
- $ this ->appEmulation ,
181
- $ this ->storeManager ,
182
- $ this ->assetRepo ,
183
- $ this ->filesystem ,
184
- $ this ->scopeConfig ,
185
- $ this ->emailConfig ,
186
- $ this ->templateFactory ,
187
- $ this ->filterManager ,
188
- $ this ->urlModel ,
189
- $ this ->filterFactory ,
190
- [],
191
- $ this ->serializerMock
192
- ])
176
+ ->setConstructorArgs (
177
+ [
178
+ $ this ->context ,
179
+ $ this ->design ,
180
+ $ this ->registry ,
181
+ $ this ->appEmulation ,
182
+ $ this ->storeManager ,
183
+ $ this ->assetRepo ,
184
+ $ this ->filesystem ,
185
+ $ this ->scopeConfig ,
186
+ $ this ->emailConfig ,
187
+ $ this ->templateFactory ,
188
+ $ this ->filterManager ,
189
+ $ this ->urlModel ,
190
+ $ this ->filterFactory ,
191
+ [],
192
+ $ this ->serializerMock
193
+ ]
194
+ )
193
195
->getMock ();
194
196
}
195
197
@@ -257,9 +259,7 @@ public function testLoadDefault(
257
259
$ expectedOrigTemplateVariables ,
258
260
$ expectedTemplateStyles
259
261
) {
260
- $ model = $ this ->getModelMock ([
261
- 'getDesignParams '
262
- ]);
262
+ $ model = $ this ->getModelMock (['getDesignParams ' ]);
263
263
264
264
$ designParams = [
265
265
'area ' => Area::AREA_FRONTEND ,
@@ -382,13 +382,15 @@ public function loadDefaultDataProvider()
382
382
public function testLoadByConfigPath ($ loadFromDatabase )
383
383
{
384
384
$ configPath = 'design/email/header_template ' ;
385
- $ model = $ this ->getModelMock ([
386
- 'getDesignConfig ' ,
387
- 'loadDefault ' ,
388
- 'load ' ,
389
- 'getTemplateText ' ,
390
- 'setTemplateText ' ,
391
- ]);
385
+ $ model = $ this ->getModelMock (
386
+ [
387
+ 'getDesignConfig ' ,
388
+ 'loadDefault ' ,
389
+ 'load ' ,
390
+ 'getTemplateText ' ,
391
+ 'setTemplateText ' ,
392
+ ]
393
+ );
392
394
393
395
$ designConfig = $ this ->getMockBuilder (\Magento \Framework \DataObject::class)
394
396
->setMethods (['getStore ' ])
@@ -611,21 +613,19 @@ public function getVariablesOptionArrayDataProvider()
611
613
'templateVariables ' => '{"store url=\"\"":"Store Url","var logo_url":"Email Logo Image Url", '
612
614
. '"var customer.name":"Customer Name"} ' ,
613
615
'expectedResult ' => [
614
- [
615
- 'label ' => __ ('Template Variables ' ),
616
- 'value ' => [
617
- [
618
- 'value ' => '{{store url=""}} ' ,
619
- 'label ' => __ ('%1 ' , 'Store Url ' ),
620
- ],
621
- [
622
- 'value ' => '{{var logo_url}} ' ,
623
- 'label ' => __ ('%1 ' , 'Email Logo Image Url ' ),
624
- ],
625
- [
626
- 'value ' => '{{var customer.name}} ' ,
627
- 'label ' => __ ('%1 ' , 'Customer Name ' ),
628
- ],
616
+ 'label ' => __ ('Template Variables ' ),
617
+ 'value ' => [
618
+ [
619
+ 'value ' => '{{store url=""}} ' ,
620
+ 'label ' => __ ('%1 ' , 'Store Url ' ),
621
+ ],
622
+ [
623
+ 'value ' => '{{var logo_url}} ' ,
624
+ 'label ' => __ ('%1 ' , 'Email Logo Image Url ' ),
625
+ ],
626
+ [
627
+ 'value ' => '{{var customer.name}} ' ,
628
+ 'label ' => __ ('%1 ' , 'Customer Name ' ),
629
629
],
630
630
],
631
631
],
@@ -640,13 +640,15 @@ public function getVariablesOptionArrayDataProvider()
640
640
*/
641
641
public function testProcessTemplate ($ templateId , $ expectedResult )
642
642
{
643
- $ model = $ this ->getModelMock ([
644
- 'load ' ,
645
- 'loadDefault ' ,
646
- 'getProcessedTemplate ' ,
647
- 'applyDesignConfig ' ,
648
- 'cancelDesignConfig ' ,
649
- ]);
643
+ $ model = $ this ->getModelMock (
644
+ [
645
+ 'load ' ,
646
+ 'loadDefault ' ,
647
+ 'getProcessedTemplate ' ,
648
+ 'applyDesignConfig ' ,
649
+ 'cancelDesignConfig ' ,
650
+ ]
651
+ );
650
652
$ model ->setId ($ templateId );
651
653
if (is_numeric ($ templateId )) {
652
654
$ model ->expects ($ this ->once ())
@@ -698,10 +700,7 @@ public function processTemplateVariable()
698
700
*/
699
701
public function testProcessTemplateThrowsExceptionNonExistentTemplate ()
700
702
{
701
- $ model = $ this ->getModelMock ([
702
- 'loadDefault ' ,
703
- 'applyDesignConfig ' ,
704
- ]);
703
+ $ model = $ this ->getModelMock (['loadDefault ' , 'applyDesignConfig ' ,]);
705
704
$ model ->expects ($ this ->once ())
706
705
->method ('loadDefault ' )
707
706
->willReturn (true );
@@ -753,23 +752,25 @@ public function testGetType($templateType, $expectedResult)
753
752
/** @var Template $model */
754
753
$ model = $ this ->getMockBuilder (Template::class)
755
754
->setMethods (['_init ' ])
756
- ->setConstructorArgs ([
757
- $ this ->createMock (Context::class),
758
- $ this ->createMock (Design::class),
759
- $ this ->createMock (Registry::class),
760
- $ this ->createMock (Emulation::class),
761
- $ this ->createMock (StoreManager::class),
762
- $ this ->createMock (Repository::class),
763
- $ this ->createMock (Filesystem::class),
764
- $ this ->createMock (ScopeConfigInterface::class),
765
- $ emailConfig ,
766
- $ this ->createMock (TemplateFactory::class),
767
- $ this ->createMock (FilterManager::class),
768
- $ this ->createMock (Url::class),
769
- $ this ->createMock (FilterFactory::class),
770
- [],
771
- $ this ->createMock (Json::class)
772
- ])
755
+ ->setConstructorArgs (
756
+ [
757
+ $ this ->createMock (Context::class),
758
+ $ this ->createMock (Design::class),
759
+ $ this ->createMock (Registry::class),
760
+ $ this ->createMock (Emulation::class),
761
+ $ this ->createMock (StoreManager::class),
762
+ $ this ->createMock (Repository::class),
763
+ $ this ->createMock (Filesystem::class),
764
+ $ this ->createMock (ScopeConfigInterface::class),
765
+ $ emailConfig ,
766
+ $ this ->createMock (TemplateFactory::class),
767
+ $ this ->createMock (FilterManager::class),
768
+ $ this ->createMock (Url::class),
769
+ $ this ->createMock (FilterFactory::class),
770
+ [],
771
+ $ this ->createMock (Json::class)
772
+ ]
773
+ )
773
774
->getMock ();
774
775
775
776
$ model ->setTemplateId (10 );
0 commit comments