@@ -443,14 +443,10 @@ public function testConfigDirectiveAvailable()
443443 $ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
444444 $ scopeConfigValue = 'value ' ;
445445
446- $ storeMock = $ this ->getMockBuilder (StoreInterface::class)
447- ->disableOriginalConstructor ()
448- ->getMockForAbstractClass ();
449-
450446 $ this ->storeManager ->expects ($ this ->any ())
451447 ->method ('getStore ' )
452448 ->willReturn ($ this ->store );
453- $ storeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
449+ $ this -> store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
454450
455451 $ this ->configVariables ->expects ($ this ->once ())
456452 ->method ('getData ' )
@@ -473,13 +469,10 @@ public function testConfigDirectiveUnavailable()
473469 $ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
474470 $ scopeConfigValue = '' ;
475471
476- $ storeMock = $ this ->getMockBuilder (StoreInterface::class)
477- ->disableOriginalConstructor ()
478- ->getMockForAbstractClass ();
479472 $ this ->storeManager ->expects ($ this ->any ())
480473 ->method ('getStore ' )
481474 ->willReturn ($ this ->store );
482- $ storeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
475+ $ this -> store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
483476
484477 $ this ->configVariables ->expects ($ this ->once ())
485478 ->method ('getData ' )
@@ -495,6 +488,58 @@ public function testConfigDirectiveUnavailable()
495488 $ this ->assertEquals ($ scopeConfigValue , $ this ->getModel ()->configDirective ($ construction ));
496489 }
497490
491+ /**
492+ * @throws NoSuchEntityException
493+ */
494+ public function testConfigDirectiveGetCountry ()
495+ {
496+ $ path = "general/store_information/country_id " ;
497+ $ availableConfigs = [['value ' => $ path ]];
498+ $ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
499+ $ expectedCountry = 'United States ' ;
500+
501+ $ this ->storeManager ->expects ($ this ->any ())
502+ ->method ('getStore ' )
503+ ->willReturn ($ this ->store );
504+ $ this ->store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
505+
506+ $ this ->configVariables ->expects ($ this ->once ())
507+ ->method ('getData ' )
508+ ->willReturn ($ availableConfigs );
509+
510+ $ this ->storeInformation ->expects ($ this ->once ())
511+ ->method ('getStoreInformationObject ' )
512+ ->willReturn (new DataObject (['country_id ' => 'US ' , 'country ' => 'United States ' ]));
513+
514+ $ this ->assertEquals ($ expectedCountry , $ this ->getModel ()->configDirective ($ construction ));
515+ }
516+
517+ /**
518+ * @throws NoSuchEntityException
519+ */
520+ public function testConfigDirectiveGetRegion ()
521+ {
522+ $ path = "general/store_information/region_id " ;
523+ $ availableConfigs = [['value ' => $ path ]];
524+ $ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
525+ $ expectedRegion = 'Texas ' ;
526+
527+ $ this ->storeManager ->expects ($ this ->any ())
528+ ->method ('getStore ' )
529+ ->willReturn ($ this ->store );
530+ $ this ->store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
531+
532+ $ this ->configVariables ->expects ($ this ->once ())
533+ ->method ('getData ' )
534+ ->willReturn ($ availableConfigs );
535+
536+ $ this ->storeInformation ->expects ($ this ->once ())
537+ ->method ('getStoreInformationObject ' )
538+ ->willReturn (new DataObject (['region_id ' => '57 ' , 'region ' => 'Texas ' ]));
539+
540+ $ this ->assertEquals ($ expectedRegion , $ this ->getModel ()->configDirective ($ construction ));
541+ }
542+
498543 /**
499544 * @throws MailException
500545 * @throws NoSuchEntityException
0 commit comments