Differences Between: [Versions 310 and 311] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
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 namespace tool_log; 18 19 /** 20 * Log manager and log API tests. 21 * 22 * @package tool_log 23 * @copyright 2014 Petr Skoda {@link http://skodak.org/} 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class manager_test extends \advanced_testcase { 27 public function test_get_log_manager() { 28 global $CFG; 29 $this->resetAfterTest(); 30 31 $manager = get_log_manager(); 32 $this->assertInstanceOf('core\log\manager', $manager); 33 34 $stores = $manager->get_readers(); 35 $this->assertIsArray($stores); 36 $this->assertCount(0, $stores); 37 38 $this->assertFileExists("$CFG->dirroot/$CFG->admin/tool/log/store/standard/version.php"); 39 $this->assertFileExists("$CFG->dirroot/$CFG->admin/tool/log/store/legacy/version.php"); 40 41 set_config('enabled_stores', 'logstore_standard,logstore_legacy', 'tool_log'); 42 $manager = get_log_manager(true); 43 $this->assertInstanceOf('core\log\manager', $manager); 44 45 $stores = $manager->get_readers(); 46 $this->assertIsArray($stores); 47 $this->assertCount(2, $stores); 48 foreach ($stores as $key => $store) { 49 $this->assertIsString($key); 50 $this->assertInstanceOf('core\log\sql_reader', $store); 51 } 52 53 $stores = $manager->get_readers('core\log\sql_internal_table_reader'); 54 $this->assertIsArray($stores); 55 $this->assertCount(1, $stores); 56 foreach ($stores as $key => $store) { 57 $this->assertIsString($key); 58 $this->assertSame('logstore_standard', $key); 59 $this->assertInstanceOf('core\log\sql_internal_table_reader', $store); 60 } 61 62 $stores = $manager->get_readers('core\log\sql_reader'); 63 $this->assertIsArray($stores); 64 $this->assertCount(2, $stores); 65 foreach ($stores as $key => $store) { 66 $this->assertIsString($key); 67 $this->assertInstanceOf('core\log\sql_reader', $store); 68 } 69 } 70 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body