예제 #1
0
 /**
  * @covers \Magento\Email\Block\Adminhtml\Template\Edit\Form::getVariables
  */
 public function testGetVariables()
 {
     $this->variablesMock->expects($this->once())->method('toOptionArray')->willReturn(['var1', 'var2', 'var3']);
     $this->variableFactoryMock->expects($this->once())->method('create')->willReturn($this->variableMock);
     $this->variableMock->expects($this->once())->method('getVariablesOptionArray')->willReturn(['custom var 1', 'custom var 2']);
     $this->registryMock->expects($this->once())->method('registry')->willReturn($this->templateMock);
     $this->templateMock->expects($this->once())->method('getId')->willReturn(1);
     $this->templateMock->expects($this->once())->method('getVariablesOptionArray')->willReturn(['template var 1', 'template var 2']);
     $this->assertEquals([['var1', 'var2', 'var3'], ['custom var 1', 'custom var 2'], ['template var 1', 'template var 2']], $this->form->getVariables());
 }
예제 #2
0
 public function testConfigDirectiveUnavailable()
 {
     $path = "web/unsecure/base_url";
     $availableConfigs = [];
     $construction = ["{{config path={$path}}}", 'config', " path={$path}"];
     $scopeConfigValue = '';
     $storeMock = $this->getMock('Magento\\Store\\Api\\Data\\StoreInterface', [], [], '', false);
     $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock);
     $storeMock->expects($this->once())->method('getId')->willReturn(1);
     $this->configVariables->expects($this->once())->method('getData')->willReturn($availableConfigs);
     $this->scopeConfig->expects($this->never())->method('getValue')->willReturn($scopeConfigValue);
     $this->assertEquals($scopeConfigValue, $this->getModel()->configDirective($construction));
 }