public function itDoesAnIntersectionWithEveryResults() { $matching_ids = array(123 => 'whatever', 456 => 'whatever', 789 => 'whatever'); $other_result_1 = array(456 => 'whatever', 789 => 'whatever'); $other_result_2 = array(456 => 'whatever'); $john = new Tracker_Report_ResultJoiner(); $results = $john->joinResults($matching_ids, array($other_result_1, $other_result_2)); $expected = array(456 => 'whatever'); $this->assertEqual($results, $expected); }
public function getMatchingIds($request = null, $use_data_from_db = false) { if (!$this->matching_ids) { $user = $this->getCurrentUser(); if ($use_data_from_db) { $criteria = $this->getCriteriaFromDb(); } else { $criteria = $this->getCriteria(); } $this->matching_ids = $this->getMatchingIdsInDb($this->getDao(), $this->getPermissionsManager(), $this->getTracker(), $user, $criteria); $additional_criteria = $this->getAdditionalCriteria(); $result = array(); $search_performed = false; EventManager::instance()->processEvent(TRACKER_EVENT_REPORT_PROCESS_ADDITIONAL_QUERY, array('request' => $request, 'result' => &$result, 'search_performed' => &$search_performed, 'tracker' => $this->getTracker(), 'additional_criteria' => $additional_criteria, 'user' => $user, 'form_element_factory' => $this->getFormElementFactory())); if ($search_performed) { $joiner = new Tracker_Report_ResultJoiner(); $this->matching_ids = $this->implodeMatchingIds($joiner->joinResults($this->getLastChangesetIdByArtifactId($this->matching_ids), $result)); } } return $this->matching_ids; }