Example #1
0
 /**
  * Saves the specified Crumbly template to the database.
  *
  * @access  public
  * @param   Crumbly_template        $template       The template to save.
  * @return  bool
  */
 public function save_crumbly_template(Crumbly_template $template)
 {
     if (!$template->get_label() or !$template->get_template_id()) {
         return FALSE;
     }
     $data = array_merge($template->to_array(), array('site_id' => $this->get_site_id()));
     $this->EE->db->insert('crumbly_templates', $data);
     return TRUE;
 }
Example #2
0
 public function test__save_crumbly_template__success()
 {
     $template = new Crumbly_template(array('label' => 'Example template', 'template_id' => 20));
     $insert_data = array('label' => $template->get_label(), 'template_id' => $template->get_template_id(), 'site_id' => $this->_site_id);
     $this->EE->db->expectOnce('insert', array('crumbly_templates', $insert_data));
     $this->assertEqual(TRUE, $this->_subject->save_crumbly_template($template));
 }