Exemple #1
0
 function testCache()
 {
     $this->cache->purge();
     self::createSQL();
     $prepSQL = 'INSERT INTO `test_table` VALUES (?), (?), (?)';
     $prepParams = [1, 2, 3];
     $agSQL = 'SELECT SUM(`key0`) FROM `test_table`';
     $agSettings = [MySQL::V_CACHE => true, MySQL::V_TIME => 20];
     PhuGlobal::$mysql->prepQuery($prepSQL, $prepParams);
     $agg = PhuGlobal::$mysql->aggregate($agSQL, null, $agSettings);
     $lastHash = PhuGlobal::$mysql->getLastHash();
     $getAll = $this->cache->getAll();
     $get = $this->cache->get($lastHash);
     $this->assertArrayHasKey($lastHash, $getAll, _unit_dump(['lastHash' => $lastHash, 'getAll' => $getAll]));
     $this->assertEquals($agg, $get, _unit_dump(['aggregate' => $agg, 'get' => $get]));
     self::deleteSQL();
 }