Example #1
0
 public function test_break_key()
 {
     $this->setExpectedException("Exception", "Cannot validate site event - key cannot be empty!");
     $Event = new SiteEvent();
     $Event->title = "asdfaf";
     $Event->user_id = 1;
     $Event->commit();
 }
Example #2
0
 /**
  * @depends testAddItem
  */
 public function test_logContributor($Item)
 {
     $User = new User();
     $User->username = "******";
     $User->contact_email = "*****@*****.**";
     $User->setPassword('sadfasdfaf');
     $User->commit();
     $Event = new SiteEvent();
     $Event->user_id = $User->id;
     $Event->module_name = "help";
     $Event->title = "Help item created";
     $Event->args = array();
     $Event->key = "help_id";
     $Event->value = $Item->id;
     $Event->commit();
     $contributors = $Item->getContributors();
     $this->assertTrue(count($contributors) > 0);
 }
Example #3
0
 /**
  * Commit changes to this idea
  * @since Version 3.8.7
  * @return $this
  */
 public function commit()
 {
     $this->validate();
     $data = array("title" => $this->title, "description" => $this->description, "slug" => $this->slug, "votes" => $this->votes, "author" => $this->Author->id, "category_id" => $this->Category->id, "date" => $this->Date->format("Y-m-d H:i:s"), "status" => $this->status);
     if (filter_var($this->id, FILTER_VALIDATE_INT)) {
         $where = array("id = ?" => $this->id);
         $this->db->update("idea_ideas", $data, $where);
     } else {
         $this->db->insert("idea_ideas", $data);
         $this->id = $this->db->lastInsertId();
         $this->Author->wheat(5);
         /**
          * Log the creation of this idea
          */
         try {
             $Event = new SiteEvent();
             $Event->title = "Suggested an idea";
             $Event->user_id = $this->Author->id;
             $Event->module_name = strtolower($this->Module->name);
             $Event->key = "idea_id";
             $Event->value = $this->id;
             $Event->commit();
         } catch (Exception $e) {
             die($e->getMessage());
         }
     }
     return $this;
 }
Example #4
0
 /**
  * Log an event
  * @since Version 3.9.1
  * @return void
  */
 private function logEvent()
 {
     try {
         $Event = new SiteEvent();
         $Event->title = "Suggested an idea";
         $Event->user_id = $this->Author->id;
         $Event->module_name = strtolower($this->Module->name);
         $Event->key = "idea_id";
         $Event->value = $this->id;
         $Event->commit();
     } catch (Exception $e) {
         //die($e->getMessage());
     }
     return;
 }