Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
namespace cachestore_static;
17
namespace cachestore_static;
18
 
18
 
19
use cache_definition;
19
use core_cache\definition;
Línea 20... Línea 20...
20
use cache_store;
20
use core_cache\store;
Línea 21... Línea 21...
21
use cachestore_static;
21
use cachestore_static;
Línea 32... Línea 32...
32
 *
32
 *
33
 * @package    cachestore_static
33
 * @package    cachestore_static
34
 * @copyright  2013 Sam Hemelryk
34
 * @copyright  2013 Sam Hemelryk
35
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
36
 */
37
class store_test extends \cachestore_tests {
37
final class store_test extends \cachestore_tests {
38
    /**
38
    /**
39
     * Returns the static class name
39
     * Returns the static class name
40
     * @return string
40
     * @return string
41
     */
41
     */
42
    protected function get_class_name() {
42
    protected function get_class_name() {
Línea 48... Línea 48...
48
     */
48
     */
49
    public function test_maxsize(): void {
49
    public function test_maxsize(): void {
50
        $defid = 'phpunit/testmaxsize';
50
        $defid = 'phpunit/testmaxsize';
51
        $config = \cache_config_testing::instance();
51
        $config = \cache_config_testing::instance();
52
        $config->phpunit_add_definition($defid, array(
52
        $config->phpunit_add_definition($defid, array(
53
            'mode' => cache_store::MODE_REQUEST,
53
            'mode' => store::MODE_REQUEST,
54
            'component' => 'phpunit',
54
            'component' => 'phpunit',
55
            'area' => 'testmaxsize',
55
            'area' => 'testmaxsize',
56
            'maxsize' => 3
56
            'maxsize' => 3
57
        ));
57
        ));
58
        $definition = cache_definition::load($defid, $config->get_definition_by_id($defid));
58
        $definition = definition::load($defid, $config->get_definition_by_id($defid));
59
        $instance = cachestore_static::initialise_test_instance($definition);
59
        $instance = cachestore_static::initialise_test_instance($definition);
Línea 60... Línea 60...
60
 
60
 
61
        $this->assertTrue($instance->set('key1', 'value1'));
61
        $this->assertTrue($instance->set('key1', 'value1'));
62
        $this->assertTrue($instance->set('key2', 'value2'));
62
        $this->assertTrue($instance->set('key2', 'value2'));
Línea 126... Línea 126...
126
        }
126
        }
127
        // Prepare the static instance.
127
        // Prepare the static instance.
128
        $defid = 'phpunit/igbinary';
128
        $defid = 'phpunit/igbinary';
129
        $config = \cache_config_testing::instance();
129
        $config = \cache_config_testing::instance();
130
        $config->phpunit_add_definition($defid, array(
130
        $config->phpunit_add_definition($defid, array(
131
            'mode' => cache_store::MODE_REQUEST,
131
            'mode' => store::MODE_REQUEST,
132
            'component' => 'phpunit',
132
            'component' => 'phpunit',
133
            'area' => 'testigbinary'
133
            'area' => 'testigbinary'
134
        ));
134
        ));
135
        $definition = cache_definition::load($defid, $config->get_definition_by_id($defid));
135
        $definition = definition::load($defid, $config->get_definition_by_id($defid));
136
        $instance = cachestore_static::initialise_test_instance($definition);
136
        $instance = cachestore_static::initialise_test_instance($definition);
137
        // Prepare an object.
137
        // Prepare an object.
138
        $obj = new \stdClass();
138
        $obj = new \stdClass();
139
        $obj->someint = 9;
139
        $obj->someint = 9;
140
        $obj->somestring = '99';
140
        $obj->somestring = '99';