/** * try to create a pdf with a linked task * */ public function testLeadPdfLinkedTask() { // create lead + task + link $task = Tasks_Controller_Task::getInstance()->create($this->objects['linkedTask']); $lead = Crm_Controller_Lead::getInstance()->get($this->objects['leadWithLink']->getId()); $lead->relations = array(array('own_model' => 'Crm_Model_Lead', 'own_backend' => 'Sql', 'own_id' => $lead->getId(), 'own_degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'related_model' => 'Tasks_Model_Task', 'related_backend' => Tasks_Backend_Factory::SQL, 'related_id' => $task->getId(), 'type' => 'TASK')); $lead = Crm_Controller_Lead::getInstance()->update($lead); $pdf = new Crm_Export_Pdf(); $pdf->generate($lead); $pdfOutput = $pdf->render(); //$pdf->save("test.pdf"); $this->assertEquals(1, preg_match("/^%PDF-1.4/", $pdfOutput), "no pdf generated"); $this->assertEquals(1, preg_match("/" . $task->summary . "/", $pdfOutput), "no summary found"); // remove Tasks_Controller_Task::getInstance()->delete($task->getId()); // purge all relations $backend = new Tinebase_Relation_Backend_Sql(); $backend->purgeAllRelations('Crm_Model_Lead', 'Sql', $this->objects['leadWithLink']->getId()); }
public function testCleanUp() { $backend = new Tinebase_Relation_Backend_Sql(); $backend->purgeAllRelations($this->_crmId['model'], $this->_crmId['backend'], $this->_crmId['id']); $backend->purgeAllRelations($this->_crmId2['model'], $this->_crmId2['backend'], $this->_crmId2['id']); }
/** * try to delete a lead * */ public function testDeleteLead() { Crm_Controller_Lead::getInstance()->delete($GLOBALS['Addressbook_ControllerTest']['leadId']); // purge all relations $backend = new Tinebase_Relation_Backend_Sql(); $backend->purgeAllRelations('Crm_Model_Lead', 'Sql', $GLOBALS['Addressbook_ControllerTest']['leadId']); // delete contact Addressbook_Controller_Contact::getInstance()->delete($this->_objects['user']->getId()); $this->setExpectedException('Tinebase_Exception_NotFound'); Crm_Controller_Lead::getInstance()->get($GLOBALS['Addressbook_ControllerTest']['leadId']); }