<commit_before><?php
/**
 * @group Component_Output_Cache
 * @group Component_Output_CacheSlow
 * @group slow
 */
class Vps_Component_Output_CacheSlowTest extends Vps_Test_TestCase
{
    private $_root;
    private $_renderer;

    private function _setup($rootClass)
    {
        Vps_Component_Data_Root::setComponentClass($rootClass);
        $this->_root = Vps_Component_Data_Root::getInstance();

        $this->_renderer = new Vps_Component_Renderer();
        $this->_renderer->setEnableCache(true);
        Vps_Component_Cache::setInstance(Vps_Component_Cache::CACHE_BACKEND_FNF);
        apc_clear_cache('user');

        Vps_Registry::get('config')->debug->componentCache->disable = false;
        Vps_Config::deleteValueCache('debug.componentCache.disable');
    }

    /*
     * Funktioniert nicht, weil TTL innerhalb eines Requests nicht berücksichtigt wird
     */
    public function testApcCli()
    {
        apc_store('foo', 'bar', 1);
        $this->assertEquals(apc_fetch('foo'), 'bar');
        //sleep(2);
        //$this->assertNull(apc_fetch('foo'));
    }

    public function testC4()
    {
        $this->_setup('Vps_Component_Output_C4_Component');
        $this->_root->render();

        $model = Vps_Component_Cache::getInstance()->getModel('cache');
        $row = $model->getRows()->current();<commit_msg>remove unused variable<commit_after><?php
/**
 * @group Component_Output_Cache
 * @group Component_Output_CacheSlow
 * @group slow
 */
class Vps_Component_Output_CacheSlowTest extends Vps_Test_TestCase
{
    private $_root;

    private function _setup($rootClass)
    {
        Vps_Component_Data_Root::setComponentClass($rootClass);
        $this->_root = Vps_Component_Data_Root::getInstance();

        Vps_Component_Cache::setInstance(Vps_Component_Cache::CACHE_BACKEND_FNF);
        apc_clear_cache('user');

        Vps_Registry::get('config')->debug->componentCache->disable = false;
        Vps_Config::deleteValueCache('debug.componentCache.disable');
    }

    /*
     * Funktioniert nicht, weil TTL innerhalb eines Requests nicht berücksichtigt wird
     */
    public function testApcCli()
    {
        apc_store('foo', 'bar', 1);
        $this->assertEquals(apc_fetch('foo'), 'bar');
        //sleep(2);
        //$this->assertNull(apc_fetch('foo'));
    }

    public function testC4()
    {
        $this->_setup('Vps_Component_Output_C4_Component');
        $this->_root->render();

        $model = Vps_Component_Cache::getInstance()->getModel('cache');
        $row = $model->getRows()->current();
{'fraction_non_alphanumeric': 0.13732394366197184, 'fraction_numerical': 0.003129890453834116, 'mean_word_length': 3.557932263814617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7311057', 'n_tokens_mistral': 783, 'n_tokens_neox': 769, 'n_words': 113}