Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
18
 
19
use Moodle\BehatExtension\Exception\SkippedException;
20
 
21
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
22
 
23
/**
24
 * Steps definitions related to Analytics.
25
 *
26
 * @package    core
27
 * @category   test
28
 * @copyright  2025 Huong Nguyen <huongnv13@gmail.com>
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class behat_analytics extends behat_base {
32
 
33
    /**
34
     * Check if mlbackend_python is configured.
35
     *
36
     * @Given /^a Python Machine Learning backend server is configured$/
37
     */
38
    public function backend_is_configured(): void {
39
        if (!defined('TEST_MLBACKEND_PYTHON_HOST')) {
40
            throw new SkippedException(
41
                'The Python Machine Learning backend server must be setup to run tests'
42
            );
43
        }
44
    }
45
 
46
    /**
47
     * Change the Python Machine Learning backend to use external server.
48
     *
49
     * @Given /^I change the Python Machine Learning backend to use external server$/
50
     */
51
    public function change_backend_to_external_server(): void {
52
        set_config('useserver', 1, 'mlbackend_python');
53
        set_config('host', TEST_MLBACKEND_PYTHON_HOST, 'mlbackend_python');
54
        set_config('port', TEST_MLBACKEND_PYTHON_PORT, 'mlbackend_python');
55
        set_config('username', TEST_MLBACKEND_PYTHON_USERNAME, 'mlbackend_python');
56
        set_config('password', TEST_MLBACKEND_PYTHON_PASSWORD, 'mlbackend_python');
57
    }
58
}