aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/tests/HTMLPurifier/DefinitionCacheHarness.php
blob: ab3cef451f22a5595974305f07869f69db364563 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness
{

    /**
     * Generate a configuration mock object that returns $values
     * to a getBatch() call
     * @param $values Values to return when getBatch is invoked
     */
    protected function generateConfigMock($serial = 'defaultserial') {
        generate_mock_once('HTMLPurifier_Config');
        $config = new HTMLPurifier_ConfigMock();
        $config->setReturnValue('getBatchSerial', $serial, array('Test'));
        $config->version = '1.0.0';
        return $config;
    }

    /**
     * Returns an anonymous def that has been setup and named Test
     */
    protected function generateDefinition($member_vars = array()) {
        $def = new HTMLPurifier_DefinitionTestable();
        $def->setup = true;
        $def->type  = 'Test';
        foreach ($member_vars as $key => $val) {
            $def->$key = $val;
        }
        return $def;
    }

}

// vim: et sw=4 sts=4