public function testToOptionArrayWithGroup()
 {
     $optionArray = $this->model->toOptionArray(true);
     $this->assertEquals('Store Contact Information', $optionArray['label']->getText());
     $optionArrayValues = $optionArray['value'];
     $this->assertEquals(count($this->configVariables), count($optionArrayValues));
     $index = 0;
     foreach ($optionArrayValues as $variable) {
         $expectedValue = '{{config path="' . $this->configVariables[$index]['value'] . '"}}';
         $expectedLabel = $this->configVariables[$index]['label'];
         $this->assertEquals($expectedValue, $variable['value']);
         $this->assertEquals($expectedLabel, $variable['label']->getText());
         $index++;
     }
 }
Beispiel #2
0
 /**
  * Retrieve variables to insert into email
  *
  * @return array
  */
 public function getVariables()
 {
     $variables = array();
     $variables[] = $this->_variables->toOptionArray(true);
     $customVariables = $this->_variableFactory->create()->getVariablesOptionArray(true);
     if ($customVariables) {
         $variables[] = $customVariables;
     }
     /* @var $template \Magento\Email\Model\Template */
     $template = $this->_coreRegistry->registry('current_email_template');
     if ($template->getId() && ($templateVariables = $template->getVariablesOptionArray(true))) {
         $variables[] = $templateVariables;
     }
     return $variables;
 }