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 * Completion test generator for Behat 19 * 20 * @package core_completion 21 * @copyright 2023 Amaia Anabitarte <amaia@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 class behat_core_completion_generator extends behat_generator_base { 25 26 /** 27 * Get a list of the entities that can be created for completion 28 * 29 * @return array[] 30 */ 31 protected function get_creatable_entities(): array { 32 return [ 33 'Course defaults' => [ 34 'singular' => 'Course default', 35 'datagenerator' => 'default_completion', 36 'required' => [ 37 'course', 38 'module', 39 ], 40 'switchids' => [ 41 'course' => 'course', 42 'module' => 'module', 43 ], 44 ], 45 ]; 46 } 47 48 /** 49 * Look up module ID from given name 50 * 51 * @param string $name 52 * @return int 53 */ 54 protected function get_module_id(string $name): int { 55 global $DB; 56 57 return (int) $DB->get_field('modules', 'id', ['name' => $name], MUST_EXIST); 58 } 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body