CacheBehaviorTestCase::testChangeDurationOnTheFly PHP Метод

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

    function testChangeDurationOnTheFly()
    {
        $this->CacheData->Behaviors->attach('Cacher.Cache', array('auto' => false));
        $results = $this->CacheData->find('all', array('conditions' => array('CacheData.name LIKE' => '%cache%'), 'cacher' => '+42 weeks'));
        $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);
        $ds = ConnectionManager::getDataSource('cacher');
        $result = Cache::config('default');
        $this->assertEquals($result['settings']['duration'], strtotime('+42weeks') - strtotime('now'));
    }