コード例 #1
0
 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));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
ファイル: Variable.php プロジェクト: whoople/magento2-testing
 /**
  * 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;
 }