[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 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/>. 16 17 /** 18 * lock unit tests 19 * 20 * @package core 21 * @category lock 22 * @copyright 2013 Damyon Wiese 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 29 /** 30 * Unit tests for our locking configuration. 31 * 32 * @package core 33 * @category lock 34 * @copyright 2013 Damyon Wiese 35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 */ 37 class lock_config_testcase extends advanced_testcase { 38 39 /** 40 * Tests the static parse charset method 41 * @return void 42 */ 43 public function test_lock_config() { 44 global $CFG; 45 $original = null; 46 if (isset($CFG->lock_factory)) { 47 $original = $CFG->lock_factory; 48 } 49 50 // Test no configuration. 51 unset($CFG->lock_factory); 52 53 $factory = \core\lock\lock_config::get_lock_factory('cache'); 54 55 $this->assertNotEmpty($factory, 'Get a default factory with no configuration'); 56 57 $CFG->lock_factory = '\core\lock\file_lock_factory'; 58 59 $factory = \core\lock\lock_config::get_lock_factory('cache'); 60 $this->assertTrue($factory instanceof \core\lock\file_lock_factory, 61 'Get a default factory with a set configuration'); 62 63 $CFG->lock_factory = '\core\lock\db_record_lock_factory'; 64 65 $factory = \core\lock\lock_config::get_lock_factory('cache'); 66 $this->assertTrue($factory instanceof \core\lock\db_record_lock_factory, 67 'Get a default factory with a changed configuration'); 68 69 if ($original) { 70 $CFG->lock_factory = $original; 71 } else { 72 unset($CFG->lock_factory); 73 } 74 } 75 } 76
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |