Example #1
0
 public function testRefreshCacheForTables()
 {
     $childrenQuery = $this->connection->createQuery()->select('*')->from('children')->setCache(true);
     $childrenResult = $childrenQuery->execute();
     $this->cache->cacheQuery($childrenQuery, $childrenResult);
     $this->assertSame($childrenResult, $this->cache->getCachedResult($childrenQuery));
     $parentsQuery = $this->connection->createQuery()->select('*')->from('parents')->setCache(true);
     $parentsResult = $parentsQuery->execute();
     $this->cache->cacheQuery($parentsQuery, $parentsResult);
     $this->assertSame($parentsResult, $this->cache->getCachedResult($parentsQuery));
     $this->cache->refreshCacheForTables(array('parents', 'children'));
     $this->assertTrue(is_null($this->cache->getCachedResult($childrenQuery)));
     $this->assertTrue(is_null($this->cache->getCachedResult($parentsQuery)));
 }