Exemplo n.º 1
0
 public function testSetAndGetId()
 {
     $this->mockModel();
     $testId = 9999;
     $this->model->setId($testId);
     $this->assertEquals($testId, $this->model->getId());
 }
Exemplo n.º 2
0
 /**
  * Check usage of template code in other templates
  *
  * @param \Magento\Email\Model\Template $template
  * @return bool
  */
 public function checkCodeUsage(\Magento\Email\Model\Template $template)
 {
     if ($template->getTemplateActual() != 0 || is_null($template->getTemplateActual())) {
         $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'COUNT(*)')->where('template_code = :template_code');
         $bind = array('template_code' => $template->getTemplateCode());
         $templateId = $template->getId();
         if ($templateId) {
             $select->where('template_id != :template_id');
             $bind['template_id'] = $templateId;
         }
         $result = $this->_getReadAdapter()->fetchOne($select, $bind);
         if ($result) {
             return true;
         }
     }
     return false;
 }