| Línea 24... |
Línea 24... |
| 24 |
* @package core_role
|
24 |
* @package core_role
|
| 25 |
* @category test
|
25 |
* @category test
|
| 26 |
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
26 |
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
| 27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 28 |
*/
|
28 |
*/
|
| 29 |
class preset_test extends \advanced_testcase {
|
29 |
final class preset_test extends \advanced_testcase {
|
| 30 |
public function test_xml(): void {
|
30 |
public function test_xml(): void {
|
| 31 |
global $DB;
|
31 |
global $DB;
|
| Línea 32... |
Línea 32... |
| 32 |
|
32 |
|
| Línea 82... |
Línea 82... |
| 82 |
* @covers \core_role_preset::parse_preset
|
82 |
* @covers \core_role_preset::parse_preset
|
| 83 |
*/
|
83 |
*/
|
| 84 |
public function test_mixed_levels(): void {
|
84 |
public function test_mixed_levels(): void {
|
| 85 |
// The problem here is that we cannot guarantee plugin contexts
|
85 |
// The problem here is that we cannot guarantee plugin contexts
|
| 86 |
// have unique short names, so we have to also support level numbers.
|
86 |
// have unique short names, so we have to also support level numbers.
|
| 87 |
$xml = file_get_contents(__DIR__ . '/fixtures/mixed_levels.xml');
|
87 |
$xml = file_get_contents(self::get_fixture_path(__NAMESPACE__, 'mixed_levels.xml'));
|
| 88 |
$this->assertTrue(\core_role_preset::is_valid_preset($xml));
|
88 |
$this->assertTrue(\core_role_preset::is_valid_preset($xml));
|
| Línea 89... |
Línea 89... |
| 89 |
|
89 |
|
| 90 |
$preset = \core_role_preset::parse_preset($xml);
|
90 |
$preset = \core_role_preset::parse_preset($xml);
|
| 91 |
$expected = [\core\context\system::LEVEL, \core\context\coursecat::LEVEL, \core\context\course::LEVEL];
|
91 |
$expected = [\core\context\system::LEVEL, \core\context\coursecat::LEVEL, \core\context\course::LEVEL];
|