|
35 | 35 | use Magento\Framework\View\Asset\Repository; |
36 | 36 | use Magento\Framework\View\LayoutFactory; |
37 | 37 | use Magento\Framework\View\LayoutInterface; |
38 | | -use Magento\Store\Api\Data\StoreInterface; |
39 | 38 | use Magento\Store\Model\Store; |
40 | 39 | use Magento\Store\Model\StoreManagerInterface; |
41 | 40 | use Magento\Variable\Model\Source\Variables; |
@@ -575,4 +574,38 @@ public function testProtocolDirectiveWithInvalidSchema() |
575 | 574 | ]; |
576 | 575 | $model->protocolDirective($data); |
577 | 576 | } |
| 577 | + |
| 578 | + /** |
| 579 | + * @dataProvider dataProviderCompanyRedirect |
| 580 | + */ |
| 581 | + public function testStoreDirectiveForCompanyRedirect($construction, $expected, $code) |
| 582 | + { |
| 583 | + $this->storeManager->expects($this->any()) |
| 584 | + ->method('getStore') |
| 585 | + ->willReturn($this->store); |
| 586 | + $this->store->expects($this->any())->method('getCode')->willReturn($code); |
| 587 | + |
| 588 | + $this->backendUrlBuilder->expects($this->once()) |
| 589 | + ->method('getUrl') |
| 590 | + ->willReturn($expected); |
| 591 | + |
| 592 | + $result = $this->getModel()->storeDirective($construction); |
| 593 | + $this->assertEquals($expected, $result); |
| 594 | + } |
| 595 | + |
| 596 | + public function dataProviderCompanyRedirect() |
| 597 | + { |
| 598 | + return [ |
| 599 | + [ |
| 600 | + ["{{store url=''}}",'store',"url=''"], |
| 601 | + 'http://m246ceeeb2b.french.test/frvw/', |
| 602 | + 'frvw' |
| 603 | + ], |
| 604 | + [ |
| 605 | + ["{{store url=''}}",'store_invalid',"url=''"], |
| 606 | + 'http://m246ceeeb2b.test/default/', |
| 607 | + 'default' |
| 608 | + ] |
| 609 | + ]; |
| 610 | + } |
578 | 611 | } |
0 commit comments