public function redefine_search_type($params) { $calculator = new FullTextSearch_TypeOfSearchCalculator(PluginManager::instance(), $this); $params['type'] = $calculator->calculate($params['user'], $params['type'], $params['service_name'], $params['project_id']); }
public function itReturnsGenericTypeIfUserWasInGenericService() { $user = mock('PFUser'); $plugin_manager = mock('PluginManager'); $fulltextsearch_plugin = mock('fulltextsearchPlugin'); $calculator = new FullTextSearch_TypeOfSearchCalculator($plugin_manager, $fulltextsearch_plugin); $current_type = 'wild guess'; $service_name = 'my service'; $project_id = 125886; stub($user)->useLabFeatures()->returns(true); $type = $calculator->calculate($user, $current_type, $service_name, $project_id); $this->assertEqual($type, 'wild guess'); }