/** * @param $appId * @param $cache * @return \AY */ private function getAY($appId, $cache) { $jsonString = <<<EOL [ {"facets":{"facet":[ { "name": "10", "facet_id": 126, "id": 2, "value": "10", "group_name": "size" }, { "name": "S", "facet_id": 2112, "id": 173, "value": "S", "group_name": "clothing_unisex_int" } ]}}, {"category_tree": { "parent_child": { "0": [ "74415" ] }, "ids": { "74415": { "active": true, "position": 1, "name": "Frauen", "parent": 0, "id": 74415 } } }} ] EOL; $exceptedRequestBody = '[{"facets":{}},{"category_tree":{"version":"2"}}]'; $client = $this->getGuzzleClient($jsonString, $exceptedRequestBody); $ay = new \AY($appId, 'token', Constants::API_ENVIRONMENT_LIVE, null, null, $cache); $ay->getApiClient()->setClient($client); return $ay; }
/** * @param string|string[] $jsonString * @param string $exceptedRequestBody * * @return \AY */ protected function getAYWithResult($jsonString, $exceptedRequestBody = null) { $client = $this->getGuzzleClient($jsonString, $exceptedRequestBody); $ay = new \AY('100', 'token'); $ay->getApiClient()->setClient($client); if ($this->setupCategoryManager === true) { $this->setupCategoryManager($ay); } if ($this->facetsResultPath) { $facets = $this->getFacetList($this->facetsResultPath); $ay->getResultFactory()->getFacetManager()->setFacets($facets); } return $ay; }