CacheBehaviorTestCase::testCacheOnTheFly PHP Метод

testCacheOnTheFly() публичный Метод

public testCacheOnTheFly ( )
    function testCacheOnTheFly()
    {
        $this->CacheData->Behaviors->attach('Cacher.Cache', array('auto' => false));
        $results = $this->CacheData->find('all', array('conditions' => array('CacheData.name LIKE' => '%cache%'), 'cacher' => true));
        $results = Set::extract('/CacheData/name', $results);
        $expected = array('A Cached Thing', 'Cache behavior');
        $this->assertEquals($results, $expected);
        // test that it's pulling from the cache
        $this->CacheData->delete(1);
        $results = $this->CacheData->find('all', array('conditions' => array('CacheData.name LIKE' => '%cache%'), 'cacher' => true));
        $results = Set::extract('/CacheData/name', $results);
        $expected = array('A Cached Thing', 'Cache behavior');
        $this->assertEquals($results, $expected);
    }