Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Roundcube\Tests\Framework; use PHPUnit\Framework\TestCase; /** * Test ..

Decoded Output download

<?php

namespace Roundcube\Tests\Framework;

use PHPUnit\Framework\TestCase;

/**
 * Test class to test rcube_cache_db class
 */
class CacheDBTest extends TestCase
{
    /**
     * Test common cache functionality
     */
    public function test_common_cache_operations()
    {
        $rcube = 
cube::get_instance();
        $db = $rcube->get_dbh();
        $db->query('DELETE FROM cache');

        $cache = new 
cube_cache_db(1, 'test', 60);

        // Set and get cache record
        $data = ['data'];

        $cache->set('test', $data);

        $this->assertSame($data, $cache->get('test'));

        $cache->close();

        $cache = new 
cube_cache_db(1, 'test', 60);

        $this->assertSame($data, $cache->get('test'));

        // Remove cached record
        $cache->remove('test');

        $this->assertNull($cache->get('test'));

        $cache->close();

        $cache = new 
cube_cache_db(1, 'test', 60);

        $this->assertNull($cache->get('test'));

        // Call expunge methods
        $cache->expunge();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Roundcube\Tests\Framework;

use PHPUnit\Framework\TestCase;

/**
 * Test class to test rcube_cache_db class
 */
class CacheDBTest extends TestCase
{
    /**
     * Test common cache functionality
     */
    public function test_common_cache_operations()
    {
        $rcube = \rcube::get_instance();
        $db = $rcube->get_dbh();
        $db->query('DELETE FROM cache');

        $cache = new \rcube_cache_db(1, 'test', 60);

        // Set and get cache record
        $data = ['data'];

        $cache->set('test', $data);

        $this->assertSame($data, $cache->get('test'));

        $cache->close();

        $cache = new \rcube_cache_db(1, 'test', 60);

        $this->assertSame($data, $cache->get('test'));

        // Remove cached record
        $cache->remove('test');

        $this->assertNull($cache->get('test'));

        $cache->close();

        $cache = new \rcube_cache_db(1, 'test', 60);

        $this->assertNull($cache->get('test'));

        // Call expunge methods
        $cache->expunge();
    }
}

Function Calls

None

Variables

None

Stats

MD5 f598d21c4335a75848598a6845f84ef0
Eval Count 0
Decode Time 79 ms