[ Index ] |
PHP Cross Reference of moodle-2.8 |
[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 * @package core_backup 19 * @category phpunit 20 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 defined('MOODLE_INTERNAL') || die(); 25 26 // Include all the needed stuff 27 global $CFG; 28 require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); 29 30 31 /** 32 * Instantiable class extending base_plan in order to be able to perform tests 33 */ 34 class mock_base_plan extends base_plan { 35 public function build() { 36 } 37 38 public function get_progress() { 39 return null; 40 } 41 } 42 43 /** 44 * Instantiable class extending base_step in order to be able to perform tests 45 */ 46 class mock_base_step extends base_step { 47 public function execute() { 48 } 49 } 50 51 /** 52 * Instantiable class extending backup_step in order to be able to perform tests 53 */ 54 class mock_backup_step extends backup_step { 55 public function execute() { 56 } 57 } 58 59 /** 60 * Instantiable class extending backup_task in order to mockup get_taskbasepath() 61 */ 62 class mock_backup_task_basepath extends backup_task { 63 64 public function build() { 65 // Nothing to do 66 } 67 68 public function define_settings() { 69 // Nothing to do 70 } 71 72 public function get_taskbasepath() { 73 global $CFG; 74 return $CFG->tempdir . '/test'; 75 } 76 } 77 78 /** 79 * Instantiable class extending backup_structure_step in order to be able to perform tests 80 */ 81 class mock_backup_structure_step extends backup_structure_step { 82 83 protected function define_structure() { 84 85 // Create really simple structure (1 nested with 1 attr and 2 fields) 86 $test = new backup_nested_element('test', 87 array('id'), 88 array('field1', 'field2') 89 ); 90 $test->set_source_array(array(array('id' => 1, 'field1' => 'value1', 'field2' => 'value2'))); 91 92 return $test; 93 } 94 } 95 96 /** 97 * Instantiable class extending activity_backup_setting to be added to task and perform tests 98 */ 99 class mock_fullpath_activity_setting extends activity_backup_setting { 100 public function process_change($setting, $ctype, $oldv) { 101 // Nothing to do 102 } 103 } 104 105 /** 106 * Instantiable class extending activity_backup_setting to be added to task and perform tests 107 */ 108 class mock_backupid_activity_setting extends activity_backup_setting { 109 public function process_change($setting, $ctype, $oldv) { 110 // Nothing to do 111 } 112 } 113 114 /** 115 * Instantiable class extending base_task in order to be able to perform tests 116 */ 117 class mock_base_task extends base_task { 118 public function build() { 119 } 120 121 public function define_settings() { 122 } 123 } 124 125 /** 126 * Instantiable class extending backup_task in order to be able to perform tests 127 */ 128 class mock_backup_task extends backup_task { 129 public function build() { 130 } 131 132 public function define_settings() { 133 } 134 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |