/** * @param $term * @param array|null $options * @return Response\SearchResultsResponse */ public function searchResults($term, array $options = null) { $path = '/openapi/services/rest/catalog/v3/searchresults'; $defaulOptions = array('categoryId' => null, 'offset' => 0, 'nrProducts' => 10, 'sortingMethod' => null, 'sortingAscending' => true, 'includeProducts' => true, 'includeCategories' => true, 'includeRefinements' => true); $query_parameters = array_merge($this->mergeOptions($defaulOptions, $options), array('term' => $term)); $uri = $path . '?' . http_build_query($query_parameters); $obj = new ResponseFactory(); return $obj->createSearchResultsResponse($this->getXmlElement($this->call($uri))); }
public function setUp() { $simpleXmlElement = new \SimpleXMLElement(__DIR__ . '/../../../../fixtures/search_results_response.xml', 0, true); $factory = new ResponseFactory(); $this->searchResultsResponse = $factory->createSearchResultsResponse($simpleXmlElement); }