/** * test getting of multiple relations for existing records * */ public function testGetMultipleRelations() { $crmIdRelations = $this->_object->getRelations($this->_crmId['model'], $this->_crmId['backend'], $this->_crmId['id']); $sharedRelation = $crmIdRelations->filter('related_model', 'Tasks_Model_Task')->getFirstRecord(); $sharedRelation['id'] = $sharedRelation['own_id'] = $sharedRelation['own_model'] = $sharedRelation['own_backend'] = ''; // lets second entry only have one shared relation $relationData = array($sharedRelation, array('own_model' => '', 'own_backend' => '', 'own_id' => '', 'own_degree' => Tinebase_Model_Relation::DEGREE_PARENT, 'related_model' => 'Addressbook_Model_Contact', 'related_backend' => '', 'related_id' => '', 'related_record' => array('n_family' => 'Weiss', 'n_given' => 'Leonie', 'bday' => '2005-07-13T00:00:00+02:00', 'container_id' => ''), 'type' => 'CUSTOMER')); $this->_object->setRelations($this->_crmId2['model'], $this->_crmId2['backend'], $this->_crmId2['id'], $relationData); $relations = $this->_object->getMultipleRelations($this->_crmId['model'], $this->_crmId['backend'], array(0 => $this->_crmId['id'], 12 => $this->_crmId2['id'])); $this->assertEquals(2, count($relations), 'number of relation sets does not fit requested number'); $this->assertArrayHasKey(0, $relations, 'crmId is missing'); $this->assertGreaterThanOrEqual(2, count($relations[0]), 'not enough relations found for crmId'); $this->assertArrayHasKey(12, $relations, 'crmId2 is missing'); $this->assertEquals(2, count($relations[12]), 'number of relations does not fit'); }