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_apcu;
17
namespace cachestore_apcu;
18
 
18
 
19
use cache_store;
19
use core_cache\store;
Línea 20... Línea 20...
20
use cache_definition;
20
use core_cache\definition;
Línea 21... Línea 21...
21
use cachestore_apcu;
21
use cachestore_apcu;
Línea 32... Línea 32...
32
 *
32
 *
33
 * @package    cachestore_apcu
33
 * @package    cachestore_apcu
34
 * @copyright  2014 Sam Hemelryk
34
 * @copyright  2014 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 apcu class name
39
     * Returns the apcu class name
40
     * @return string
40
     * @return string
41
     */
41
     */
42
    protected function get_class_name() {
42
    protected function get_class_name() {
Línea 52... Línea 52...
52
 
52
 
53
    /**
53
    /**
54
     * Test that the Moodle APCu store doesn't cross paths with other code using APCu as well.
54
     * Test that the Moodle APCu store doesn't cross paths with other code using APCu as well.
55
     */
55
     */
56
    public function test_cross_application_interaction(): void {
56
    public function test_cross_application_interaction(): void {
57
        $definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
57
        $definition = definition::load_adhoc(store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
58
        $instance = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
58
        $instance = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
Línea 59... Línea 59...
59
        $instance->initialise($definition);
59
        $instance->initialise($definition);
60
 
60
 
Línea 71... Línea 71...
71
        $this->assertTrue(apcu_exists('test'));
71
        $this->assertTrue(apcu_exists('test'));
72
        $this->assertSame('pirate', apcu_fetch('test'));
72
        $this->assertSame('pirate', apcu_fetch('test'));
73
    }
73
    }
Línea 74... Línea 74...
74
 
74
 
75
    public function test_different_caches_have_different_prefixes(): void {
75
    public function test_different_caches_have_different_prefixes(): void {
76
        $definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
76
        $definition = definition::load_adhoc(store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
77
        $instance = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
77
        $instance = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
Línea 78... Línea 78...
78
        $instance->initialise($definition);
78
        $instance->initialise($definition);
79
 
79
 
80
        $definition2 = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test2');
80
        $definition2 = definition::load_adhoc(store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test2');
Línea 81... Línea 81...
81
        $instance2 = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
81
        $instance2 = new cachestore_apcu('Test', cachestore_apcu::unit_test_configuration());
82
        $instance2->initialise($definition2);
82
        $instance2->initialise($definition2);