__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_completion;
/**
* Tests that completion works without requiring unnecessary capabilities.
*
* @package core_completion
* @copyright 2018 University of Nottingham
* @author Neill Magill <neill.magill@nottingham.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class capabilities_test extends \advanced_testcase {
/**
* A user who does not have capabilities to add events to the calendar should be able to create activities.
*/
public function test_creation_with_no_calendar_capabilities(): void {
$this->resetAfterTest();
$course = self::getDataGenerator()->create_course(['enablecompletion' => 1]);
$context = \context_course::instance($course->id);
$user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
$roleid = self::getDataGenerator()->create_role();
self::getDataGenerator()->role_assign($roleid, $user->id, $context->id);
assign_capability('moodle/calendar:manageentries', CAP_PROHIBIT, $roleid, $context, true);
$generator = self::getDataGenerator()->get_plugin_generator('mod_forum');
// Create an instance as a user without the calendar capabilities.
$this->setUser($user);
$params = array(
'course' => $course->id,
'completionexpected' => time() + 2000,
);
$generator->create_instance($params);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| behat | Folder | 0777 |
|
|
| fixtures | Folder | 0777 |
|
|
| generator | Folder | 0777 |
|
|
| privacy | Folder | 0777 |
|
|
| activity_custom_completion_test.php | File | 6.84 KB | 0777 |
|
| api_test.php | File | 15.96 KB | 0777 |
|
| bulk_update_test.php | File | 13.74 KB | 0777 |
|
| capabilities_test.php | File | 2.09 KB | 0777 |
|
| cm_completion_details_test.php | File | 25.23 KB | 0777 |
|
| completion_criteria_test.php | File | 12.46 KB | 0777 |
|
| coverage.php | File | 1.62 KB | 0777 |
|
| externallib_test.php | File | 30.64 KB | 0777 |
|
| generator_test.php | File | 4.52 KB | 0777 |
|
| progress_test.php | File | 12.17 KB | 0777 |
|