Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * Database driver test class for testing moodle_read_slave_trait 19 * 20 * @package core 21 * @category dml 22 * @copyright 2018 Srdjan Janković, Catalyst IT 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 require_once (__DIR__.'/read_slave_moodle_database.php'); 29 require_once (__DIR__.'/read_slave_moodle_recordset_special.php'); 30 31 /** 32 * Database driver mock test class that uses read_slave_moodle_recordset_special 33 * 34 * @package core 35 * @category dml 36 * @copyright 2018 Catalyst IT 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class read_slave_moodle_database_special extends read_slave_moodle_database { 40 /** 41 * Returns empty array 42 * @param string $sql the SQL select query to execute. 43 * @param array $params array of sql parameters 44 * @param int $limitfrom return a subset of records, starting at this point (optional). 45 * @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set). 46 * @return string $handle handle property 47 */ 48 public function get_records_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0) { 49 $dbhandle = parent::get_records_sql($sql, $params); 50 return []; 51 } 52 53 /** 54 * Returns fake recordset 55 * @param string $sql 56 * @param array $params 57 * @param int $limitfrom 58 * @param int $limitnum 59 * @return bool true 60 */ 61 public function get_recordset_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0) { 62 $dbhandle = parent::get_recordset_sql($sql, $params); 63 return new read_slave_moodle_recordset_special(); 64 } 65 66 /** 67 * Count the records in a table where all the given conditions met. 68 * 69 * @param string $table The table to query. 70 * @param array $conditions optional array $fieldname=>requestedvalue with AND in between 71 * @return int The count of records returned from the specified criteria. 72 */ 73 public function count_records($table, array $conditions = null) { 74 return 1; 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body