/**
  * get lead
  * 
  * @param boolean $addCf
  * @param boolean $addTags
  * @return Crm_Model_Lead
  */
 protected function _getLead($addCf = TRUE, $addTags = TRUE)
 {
     if ($addCf) {
         $cfc = Tinebase_CustomFieldTest::getCustomField(array('application_id' => Tinebase_Application::getInstance()->getApplicationByName('Crm')->getId(), 'model' => 'Crm_Model_Lead', 'name' => Tinebase_Record_Abstract::generateUID()));
         $this->_cfcName = $cfc->name;
         $cfs = array($this->_cfcName => '1234');
         Tinebase_CustomField::getInstance()->addCustomField($cfc);
     } else {
         $cfs = array();
     }
     if ($addTags) {
         $tags = array(array('name' => 'lead tag', 'type' => Tinebase_Model_Tag::TYPE_SHARED));
     } else {
         $tags = array();
     }
     return new Crm_Model_Lead(array('lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => Tinebase_Container::getInstance()->getDefaultContainer('Crm')->getId(), 'start' => Tinebase_DateTime::now(), 'description' => 'Description', 'end' => NULL, 'turnover' => 0, 'probability' => 70, 'end_scheduled' => NULL, 'tags' => $tags, 'customfields' => $cfs));
 }
 /**
  * created customfield config
  * 
  * @return Tinebase_Model_CustomField_Config
  */
 protected function _createCustomfield($cfName = NULL)
 {
     $cfName = $cfName !== NULL ? $cfName : Tinebase_Record_Abstract::generateUID();
     $cfc = Tinebase_CustomFieldTest::getCustomField(array('application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId(), 'model' => 'Addressbook_Model_Contact', 'name' => $cfName));
     $createdCustomField = Tinebase_CustomField::getInstance()->addCustomField($cfc);
     $this->_customfieldIdsToDelete[] = $createdCustomField->getId();
     return $createdCustomField;
 }