/**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_applicationName = 'Phone';
     $this->_backend = Phone_Backend_Factory::factory(Phone_Backend_Factory::CALLHISTORY);
     $this->_modelName = 'Phone_Model_Call';
     $this->_purgeRecords = TRUE;
     $this->_doRightChecks = FALSE;
     // activate this if you want to use containers
     $this->_doContainerACLChecks = FALSE;
 }
 /**
  * test start
  * 
  */
 public function testStartCall()
 {
     // remove old call
     try {
         $call = $this->_backend->getCall($this->_objects['call']->getId());
         $backend = Phone_Backend_Factory::factory(Phone_Backend_Factory::CALLHISTORY);
         $backend->delete($this->_objects['call']->getId());
     } catch (Exception $e) {
         // do nothing
     }
     $call = $this->_backend->callStarted($this->_objects['call']);
     $this->assertEquals($this->_objects['call']->destination, $call->destination);
     $this->assertTrue(Tinebase_DateTime::now()->sub($call->start)->getTimestamp() >= 0);
     // sleep for 2 secs (ringing...)
     sleep(2);
 }
 /**
  * get one call from the backend
  *
  * @param string $_callId the callId
  * @return Phone_Model_Call
  */
 public function getCall($_callId)
 {
     $backend = Phone_Backend_Factory::factory(Phone_Backend_Factory::CALLHISTORY);
     $call = $backend->get($_callId);
     return $call;
 }
Beispiel #4
0
 /**
  * Tears down the fixture
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     // remove phone, location, template
     $phoneBackend = new Voipmanager_Backend_Snom_Phone();
     $snomLocationBackend = new Voipmanager_Backend_Snom_Location();
     $snomTemplateBackend = new Voipmanager_Backend_Snom_Template();
     $snomSoftwareBackend = new Voipmanager_Backend_Snom_Software();
     $snomSettingBackend = new Voipmanager_Backend_Snom_Setting();
     $snomLineBackend = new Voipmanager_Backend_Snom_Line();
     $asteriskSipPeerBackend = new Voipmanager_Backend_Asterisk_SipPeer();
     $callHistoryBackend = Phone_Backend_Factory::factory(Phone_Backend_Factory::CALLHISTORY);
     $snomPhoneSettingBackend = new Voipmanager_Backend_Snom_PhoneSettings();
     $snomPhoneSettingBackend->delete($this->_objects['phone']->getId());
     $phoneBackend->delete($this->_objects['phone']->getId());
     $snomLocationBackend->delete($this->_objects['location']->getId());
     $snomTemplateBackend->delete($this->_objects['template']->getId());
     $snomSoftwareBackend->delete($this->_objects['software']->getId());
     $snomSettingBackend->delete($this->_objects['setting']->getId());
     $snomLineBackend->delete($this->_objects['line']->getId());
     $asteriskSipPeerBackend->delete($this->_objects['sippeer']->getId());
     $callHistoryBackend->delete($this->_objects['call1']->getId());
     $callHistoryBackend->delete($this->_objects['call2']->getId());
 }