/** * get snom_phone_line by id * * @param string $_id the id of the line * @return Voipmanager_Model_Snom_Line */ public function get($_id) { $id = Voipmanager_Model_Snom_Line::convertSnomLineIdToInt($_id); if (($result = $this->_cache->load('snomPhoneLine_' . $id)) === false) { $result = $this->_backend->get($id); $this->_cache->save($result, 'snomPhoneLine_' . $id, array('snomPhoneLine'), 5); } return $result; }
/** * test update of snom phone * */ public function testCreateSnomPhoneWithLines() { $testPhone = $this->getSnomPhone(); $sipPeer = $this->_json->saveAsteriskSipPeer($this->_getAsteriskSipPeer()->toArray()); $this->_toDelete['sippeer'][] = $sipPeer; $sipPeer['context_id'] = $sipPeer['context_id']['value']; $sipPeer['cfi_mode'] = 'number'; $snomLine = new Voipmanager_Model_Snom_Line(array('asteriskline_id' => $sipPeer, 'linenumber' => 1, 'lineactive' => 1, 'idletext' => 'idle')); $testPhone['lines'] = array($snomLine->toArray()); // save $returned = $this->_json->saveSnomPhone($testPhone); $this->_toDelete['phone'][] = $returned; // check result $this->assertGreaterThan(0, count($returned['lines'])); $this->assertEquals($sipPeer, $returned['lines'][0]['asteriskline_id']); }