/**
  * @depends test_is_assigned_agent
  */
 public function test_assign_agent()
 {
     $data = array('title' => 'A survey', 'agents' => array(1, 2, 3));
     $survey = new Survey_entity($data);
     $this->assertTrue($survey->assign_agent(4));
     // Assigning an already assigned agent.
     $this->assertFalse($survey->assign_agent(1));
 }
Esempio n. 2
0
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * File survey2.fix.php
 * Fixtures for survey2
 * 
 * Since the id comes from autoincrement, the loading order is important. 
 */
// Copy files for survey : Handlebars vs something else
copy('resources/fixtures_data/survey_2_xls.xls', 'files/surveys/survey_2_xls.xls');
copy('resources/fixtures_data/survey_2_xml.xml', 'files/surveys/survey_2_xml.xml');
// Survey 2.
$survey = new Survey_entity(array('title' => 'Handlebars', 'client' => 'Digital Dreams Inc', 'status' => Survey_entity::STATUS_OPEN, 'goal' => 20, 'introduction' => 'Hi, my name is ______ and I am calling on behalf of Digital Dreams. Handlebars is interested in learning more about you and your relation with it. You are being contacted because of your participation in the workshop held near your house. We would like to ask you some questions about your coffee consumption while using handlebars. Your participation is very important, because your responses will help us improve our framework and thus make it more usable. This survey will only take about 5 minutes of your time.', 'description' => 'This survey will help us understand how handlebars is used by developers and how it can be improved.', 'files' => array('xls' => "survey_2_xls.xls", 'xml' => "survey_2_xml.xml", 'last_conversion' => array('date' => NULL, 'warnings' => NULL))));
// Assign agent, user 3
$survey->assign_agent(3);
$this->survey_model->save($survey);
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Call task.
$call_task = new Call_task_entity(array('number' => "1000000000001", 'assigned' => Mongo_db::date(), 'author' => 1, 'assignee_uid' => 3, 'survey_sid' => 2));
$call_task->add_status(new Call_task_status(array('code' => Call_task_status::NO_REPLY, 'message' => NULL, 'author' => 3, 'created' => Mongo_db::date())));
$call_task->add_status(new Call_task_status(array('code' => Call_task_status::NO_REPLY, 'message' => NULL, 'author' => 3, 'created' => Mongo_db::date())));
$this->call_task_model->save($call_task);
///////////////////////////////////////////////////////
// Call task.
$call_task = new Call_task_entity(array('number' => "1000000000002", 'assigned' => Mongo_db::date(), 'author' => 1, 'assignee_uid' => 3, 'survey_sid' => 2));
$call_task->add_status(new Call_task_status(array('code' => Call_task_status::CANT_COMPLETE, 'message' => 'Not to be done right now. Maybe later.', 'author' => 3, 'created' => Mongo_db::date())));
$this->call_task_model->save($call_task);
///////////////////////////////////////////////////////