コード例 #1
0
ファイル: SelectTest.php プロジェクト: lytc/sloths
 public function testAllWithCache()
 {
     $rows = [['id' => 1]];
     $cacheManager = $this->getMock('Sloths\\Cache\\CacheManager', ['get']);
     $cacheManager->expects($this->once())->method('get')->with(Select::CACHE_KEY_PREFIX . '.' . md5("SELECT users.* FROM users"))->willReturnCallback(function ($key, &$success) use($rows) {
         $success = true;
         return $rows;
     });
     $select = new Select();
     $select->setCacheManager($cacheManager);
     $select->table('users')->remember(10);
     $this->assertSame($rows, $select->all());
 }