/** * */ public function testFacets() { $ay = $this->getAYWithResultFile('facets-206.json'); $facets = $ay->fetchFacets(array(206)); $this->assertInternalType('array', $facets); $count = 0; foreach ($facets as $facet) { $this->assertInstanceOf('\\AboutYou\\SDK\\Model\\Facet', $facet); $this->assertInternalType('int', $facet->getId()); $this->assertInternalType('string', $facet->getName()); $this->assertInternalType('string', $facet->getValue()); $this->assertInternalType('int', $facet->getGroupId()); $this->assertInternalType('string', $facet->getGroupName()); $this->assertEquals('size_code', $facet->getGroupName()); $this->assertEquals(206, $facet->getGroupId()); if ($count++ > 2) { break; } // tree is enough } $facet = $facets[\AboutYou\SDK\Model\Facet::uniqueKey(206, 2353)]; $this->assertEquals($facet, reset($facets)); $this->assertEquals(2353, $facet->getId()); $this->assertEquals('01', $facet->getName()); }
public function getFacet($groupId, $facetId) { $key = Facet::uniqueKey($groupId, $facetId); return isset($this->factes[$key]) ? $this->factes[$key] : null; }
/** * {@inheritdoc} */ public function getFacet($groupId, $id) { $lookupKey = Facet::uniqueKey($groupId, $id); return isset($this->facets[$lookupKey]) ? $this->facets[$lookupKey] : null; }