[ 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 * CLI script to set up all the behat test environment. 19 * 20 * @package tool_behat 21 * @copyright 2013 David Monllaó 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 if (isset($_SERVER['REMOTE_ADDR'])) { 26 die(); // No access from web! 27 } 28 29 // Force OPcache reset if used, we do not want any stale caches 30 // when preparing test environment. 31 if (function_exists('opcache_reset')) { 32 opcache_reset(); 33 } 34 35 // Is not really necessary but adding it as is a CLI_SCRIPT. 36 define('CLI_SCRIPT', true); 37 define('CACHE_DISABLE_ALL', true); 38 39 // Basic functions. 40 require_once (__DIR__ . '/../../../../lib/clilib.php'); 41 require_once (__DIR__ . '/../../../../lib/behat/lib.php'); 42 43 // Changing the cwd to admin/tool/behat/cli. 44 chdir(__DIR__); 45 $output = null; 46 exec("php util.php --diag", $output, $code); 47 if ($code == 0) { 48 echo "Behat test environment already installed\n"; 49 50 } else if ($code == BEHAT_EXITCODE_INSTALL) { 51 52 testing_update_composer_dependencies(); 53 54 // Behat and dependencies are installed and we need to install the test site. 55 chdir(__DIR__); 56 passthru("php util.php --install", $code); 57 if ($code != 0) { 58 exit($code); 59 } 60 61 } else if ($code == BEHAT_EXITCODE_REINSTALL) { 62 63 testing_update_composer_dependencies(); 64 65 // Test site data is outdated. 66 chdir(__DIR__); 67 passthru("php util.php --drop", $code); 68 if ($code != 0) { 69 exit($code); 70 } 71 72 passthru("php util.php --install", $code); 73 if ($code != 0) { 74 exit($code); 75 } 76 77 } else if ($code == BEHAT_EXITCODE_COMPOSER) { 78 // Missing Behat dependencies. 79 80 testing_update_composer_dependencies(); 81 82 // Returning to admin/tool/behat/cli. 83 chdir(__DIR__); 84 passthru("php util.php --install", $code); 85 if ($code != 0) { 86 exit($code); 87 } 88 89 } else { 90 // Generic error, we just output it. 91 echo implode("\n", $output)."\n"; 92 exit($code); 93 } 94 95 // Enable editing mode according to config.php vars. 96 passthru("php util.php --enable", $code); 97 if ($code != 0) { 98 exit($code); 99 } 100 101 exit(0);
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 |