@@ -443,14 +443,10 @@ public function testConfigDirectiveAvailable()
443
443
$ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
444
444
$ scopeConfigValue = 'value ' ;
445
445
446
- $ storeMock = $ this ->getMockBuilder (StoreInterface::class)
447
- ->disableOriginalConstructor ()
448
- ->getMockForAbstractClass ();
449
-
450
446
$ this ->storeManager ->expects ($ this ->any ())
451
447
->method ('getStore ' )
452
448
->willReturn ($ this ->store );
453
- $ storeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
449
+ $ this -> store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
454
450
455
451
$ this ->configVariables ->expects ($ this ->once ())
456
452
->method ('getData ' )
@@ -473,13 +469,10 @@ public function testConfigDirectiveUnavailable()
473
469
$ construction = ["{{config path= {$ path }}} " , 'config ' , " path= {$ path }" ];
474
470
$ scopeConfigValue = '' ;
475
471
476
- $ storeMock = $ this ->getMockBuilder (StoreInterface::class)
477
- ->disableOriginalConstructor ()
478
- ->getMockForAbstractClass ();
479
472
$ this ->storeManager ->expects ($ this ->any ())
480
473
->method ('getStore ' )
481
474
->willReturn ($ this ->store );
482
- $ storeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
475
+ $ this -> store ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
483
476
484
477
$ this ->configVariables ->expects ($ this ->once ())
485
478
->method ('getData ' )
@@ -495,6 +488,58 @@ public function testConfigDirectiveUnavailable()
495
488
$ this ->assertEquals ($ scopeConfigValue , $ this ->getModel ()->configDirective ($ construction ));
496
489
}
497
490
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
+
498
543
/**
499
544
* @throws MailException
500
545
* @throws NoSuchEntityException
0 commit comments