Skip to content

Commit b36d05d

Browse files
AnujNehraAnujNehra
authored andcommitted
ACP2E-1529 unit test
1 parent c0270e0 commit b36d05d

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ public function storeDirective($construction)
588588
* Pass extra parameter to distinguish stores urls for property Magento\Framework\Url $cacheUrl
589589
* in multi-store environment
590590
*/
591-
if ($construction[1]!="store" && $construction[2]!="url=''") {
591+
if ($construction[1] !== "store") {
592592
$this->urlModel->setScope($this->_storeManager->getStore());
593593
}
594594
$params['_escape_params'] = $this->_storeManager->getStore()->getCode();

app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use Magento\Framework\View\Asset\Repository;
3636
use Magento\Framework\View\LayoutFactory;
3737
use Magento\Framework\View\LayoutInterface;
38-
use Magento\Store\Api\Data\StoreInterface;
3938
use Magento\Store\Model\Store;
4039
use Magento\Store\Model\StoreManagerInterface;
4140
use Magento\Variable\Model\Source\Variables;
@@ -575,4 +574,38 @@ public function testProtocolDirectiveWithInvalidSchema()
575574
];
576575
$model->protocolDirective($data);
577576
}
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+
}
578611
}

0 commit comments

Comments
 (0)