public function testGetValueText() { $type = \Magento\Variable\Model\Variable::TYPE_TEXT; $plain = 'plain'; $this->model->setData('plain_value', $plain); $this->assertSame($plain, $this->model->getValue($type)); }
public function testGetValue() { $html = '<p>test</p>'; $text = 'test'; $this->_model->setData(['code' => 'test_code', 'html_value' => $html, 'plain_value' => $text]); $this->assertEquals($html, $this->_model->getValue()); $this->assertEquals($html, $this->_model->getValue(\Magento\Variable\Model\Variable::TYPE_HTML)); $this->assertEquals($text, $this->_model->getValue(\Magento\Variable\Model\Variable::TYPE_TEXT)); }
/** * Load variable by code * * @param \Magento\Variable\Model\Variable $object * @param string $code * @return $this */ public function loadByCode(\Magento\Variable\Model\Variable $object, $code) { if ($result = $this->getVariableByCode($code, true, $object->getStoreId())) { $object->setData($result); } return $this; }