public function testPreCacheFacets()
 {
     $cache = new ArrayCache();
     $ay = $this->getAY(null, null, $cache);
     $facetManager = $ay->getResultFactory()->getFacetManager();
     $this->assertTrue($facetManager->isEmpty());
     $ay->preCache();
     $this->assertFalse($facetManager->isEmpty());
     /** @var DefaultFacetManager $facetManager */
     $facetManager = new DefaultFacetManager($cache, $ay->getAppId());
     $this->assertFalse($facetManager->isEmpty());
     return $cache;
 }
 public function testPreCache()
 {
     $cache = new ArrayCache();
     $appId = '100';
     $ay = $this->getAY($appId, $cache);
     $ay->preCache(\AY::PRE_CACHE_ALL);
     $categoryManager = new DefaultCategoryManager($cache, $appId);
     $categories = $categoryManager->getAllCategories();
     $this->assertCount(1, $categories);
     $this->assertArrayHasKey(74415, $categories);
     $facetManager = new DefaultFacetManager($cache, $appId);
     $facet1 = $facetManager->getFacet(2, 126);
     $this->assertInstanceOf('\\AboutYou\\SDK\\Model\\Facet', $facet1);
     $this->assertEquals('10', $facet1->getValue());
     $facet2 = $facetManager->getFacet(173, 2112);
     $this->assertInstanceOf('\\AboutYou\\SDK\\Model\\Facet', $facet2);
     $this->assertEquals('S', $facet2->getName());
     $facets = $cache->fetch('AY:SDK:' . $appId . ':facets');
     $this->assertCount(2, $facets);
 }