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); }
public function testLoadCachedCategories() { $cache = $this->getFilledCache(); $categoryManager = new DefaultCategoryManager($cache, ''); $this->assertFalse($categoryManager->isEmpty()); $this->assertCount(9, $categoryManager->getAllCategories()); }