// "languageandlocation" settingpage
$temp = new admin_settingpage('langsettings', new lang_string('languagesettings', 'admin'));
- $temp->add(new admin_setting_configcheckbox('autolang', new lang_string('autolang', 'admin'), new lang_string('configautolang', 'admin'), 1));
- $temp->add(new admin_setting_configselect('lang', new lang_string('lang', 'admin'), new lang_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
- $temp->add(new admin_setting_configcheckbox('langmenu', new lang_string('langmenu', 'admin'), new lang_string('configlangmenu', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('autolang',
+ new lang_string('autolang', 'admin'), new lang_string('configautolang', 'admin'), 1));
+ $temp->add(new admin_setting_configselect('lang', new lang_string('lang', 'admin'),
+ new lang_string('configlang', 'admin'), current_language(),
+ get_string_manager()->get_list_of_translations()));
+ // The $CFG->lang variable might be set in installer already, default en is in setup.php.
+ $temp->add(new admin_setting_configcheckbox('keeplogoutlang', new lang_string('keeplogoutlang', 'admin'),
+ new lang_string('keeplogoutlang_desc', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('langmenu', new lang_string('langmenu', 'admin'),
+ new lang_string('configlangmenu', 'admin'), 1));
$temp->add(new admin_setting_langlist());
- $temp->add(new admin_setting_configcheckbox('langcache', new lang_string('langcache', 'admin'), new lang_string('langcache_desc', 'admin'), 1));
- $temp->add(new admin_setting_configcheckbox('langstringcache', new lang_string('langstringcache', 'admin'), new lang_string('configlangstringcache', 'admin'), 1));
- $temp->add(new admin_setting_configtext('locale', new lang_string('localetext', 'admin'), new lang_string('configlocale', 'admin'), '', PARAM_FILE));
- $temp->add(new admin_setting_configselect('latinexcelexport', new lang_string('latinexcelexport', 'admin'), new lang_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
+ $temp->add(new admin_setting_configcheckbox('langcache', new lang_string('langcache', 'admin'),
+ new lang_string('langcache_desc', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('langstringcache', new lang_string('langstringcache', 'admin'),
+ new lang_string('configlangstringcache', 'admin'), 1));
+ $temp->add(new admin_setting_configtext('locale', new lang_string('localetext', 'admin'),
+ new lang_string('configlocale', 'admin'), '', PARAM_FILE));
+ $temp->add(new admin_setting_configselect('latinexcelexport', new lang_string('latinexcelexport', 'admin'),
+ new lang_string('configlatinexcelexport', 'admin'), '0', array('0' => 'Unicode', '1' => 'Latin')));
$ADMIN->add('language', $temp);
I need to display courses short names along with courses full names
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course fullname | C_shortname | 0 |
And I log in as "admin"
I need to filter the users account list using different filter
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email | auth | confirmed |
| user1 | User | One | one@asd.com | manual | 0 |
| user2 | User | Two | two@asd.com | ldap | 1 |
| user3 | User | Three | three@asd.com | manual | 1 |
| user4 | User | Four | four@asd.com | ldap | 0 |
- And the following "cohorts" exists:
+ And the following "cohorts" exist:
| name | idnumber |
| Cohort 1 | CH1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| user1 | C1 | student |
| user2 | C1 | student |
@javascript
Scenario: Upload users enrolling them on courses and groups
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Maths | math102 | 0 |
- And the following "groups" exists:
+ And the following "groups" exist:
| name | course | idnumber |
| Section 1 | math102 | S1 |
| Section 3 | math102 | S3 |
And I log in as "admin"
- And I collapse "Front page settings" node
- And I expand "Site administration" node
- And I expand "Users" node
- And I expand "Accounts" node
- And I follow "Upload users"
+ And I navigate to "Upload users" node in "Site administration > Users > Accounts"
When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
And I press "Upload users"
Then I should see "Upload users preview"
@javascript
Scenario: Locators inside specific DOM nodes using CSS selectors
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I follow "Course 1"
When I dock "Administration" block
- Then I should not see "Question bank" in the "region-pre" "region"
+ Then I should not see "Question bank" in the ".block-region" "css_element"
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
@javascript
Scenario: Locators inside specific DOM nodes using XPath
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
When I dock "Administration" block
- Then I should not see "Turn editing on" in the "region-pre" "region"
+ Then I should not see "Turn editing on" in the ".block-region" "css_element"
I need to fill the database with fixtures
Scenario: Add a bunch of users
- Given the following "users" exists:
+ Given the following "users" exist:
| username | password | firstname | lastname |
| testuser | testuser | | |
| testuser2 | testuser2 | TestFirstname | TestLastname |
@javascript
Scenario: Add a bunch of courses and categories
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | CAT1 | CAT2 |
| Cat 3 | CAT1 | CAT3 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | COURSE1 | CAT3 |
| Course 2 | COURSE2 | CAT3 |
@javascript
Scenario: Add a bunch of groups and groupings
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
- And the following "groups" exists:
+ And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
- And the following "groupings" exists:
+ And the following "groupings" exist:
| name | course | idnumber |
| Grouping 1 | C1 | GG1 |
| Grouping 2 | C1 | GG2 |
@javascript
Scenario: Role overrides
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "categories" exists:
+ And the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
- And the following "permission overrides" exists:
+ And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/forum:editanypost | Allow | student | Course | C1 |
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
And I press "Cancel"
Scenario: Add course enrolments
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "student1"
Then I should see "Topic 1"
Scenario: Add role assigns
- Given the following "roles" exists:
+ Given the following "roles" exist:
| name | shortname | description | archetype |
| Custom editing teacher | custom1 | My custom role 1 | editingteacher |
| Custom student | custom2 | | |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| user1 | User | 1 | user1@moodlemoodle.com |
| user2 | User | 2 | user2@moodlemoodle.com |
| user3 | User | 3 | user3@moodlemoodle.com |
| user4 | User | 4 | user4@moodlemoodle.com |
| user5 | User | 5 | user5@moodlemoodle.com |
- And the following "categories" exists:
+ And the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | CAT1 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| user4 | C1 | custom1 |
- And the following "role assigns" exists:
+ And the following "role assigns" exist:
| user | role | contextlevel | reference |
| user1 | manager | System | |
| user2 | editingteacher | Category | CAT1 |
And I follow "Course 1"
And I should see "You can not enrol yourself in this course."
-
Scenario: Add modules
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Test assignment name | Test assignment description | C1 | assign1 |
| assignment | Test assignment22 name | Test assignment22 description | C1 | assignment1 |
@javascript
Scenario: Add relations between users and groups
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
- And the following "groups" exists:
+ And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
- And the following "groupings" exists:
+ And the following "groupings" exist:
| name | course | idnumber |
| Grouping 1 | C1 | GG1 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
- And the following "group members" exists:
+ And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
- And the following "grouping groups" exists:
+ And the following "grouping groups" exist:
| grouping | group |
| GG1 | G1 |
When I log in as "admin"
I need to allow/deny the existing capabilities at different levels
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
I need to verify it all works in real moodle forms
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | email | firstname | lastname |
| student1 | s1@asd.com | Student | 1 |
| student2 | s2@asd.com | Student | 2 |
| student3 | s3@asd.com | Student | 3 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| admin | C1 | editingteacher |
- And the following "groups" exists:
+ And the following "groups" exist:
| name | description | course | idnumber |
| Group 1 | G1 description | C1 | G1 |
| Group 2 | G1 description | C1 | G2 |
- And the following "group members" exists:
+ And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
| student2 | G2 |
| student3 | G2 |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
And I log in as "admin"
Background:
Given I am on homepage
And I log in as "admin"
- And I expand "Site administration" node
- And I expand "Development" node
- And I follow "Acceptance testing"
+ And I navigate to "Acceptance testing" node in "Site administration > Development"
@javascript
Scenario: Accessing the list
@javascript
Scenario: Basic forms manipulation
Given I log in as "admin"
- And I follow "Admin User"
- And I follow "Edit profile"
+ And I navigate to "Edit profile" node in "My profile settings"
When I set the field "First name" to "Field value"
And I set the field "Text editor" to "Plain text area"
And I set the field "Unmask" to "1"
@javascript
Scenario: Expand all fieldsets and advanced elements
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
Background:
Given I am on homepage
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
- And I follow "Admin User"
- And I follow "Edit profile"
+ And I navigate to "Edit profile" node in "My profile settings"
Scenario: Use nasty strings on steps arguments
When I set the field "Surname" to "$NASTYSTRING1"
/**
* Helper trait buffered_writer. Adds buffer support for the store.
- * \tool_log\helper\store must be included before using this trait.
*
* @package tool_log
* @copyright 2014 onwards Ankit Agarwal
protected $count = 0;
/**
- * Write event in the store with buffering. Method insert_events() must be
+ * Should the event be ignored (== not logged)?
+ * @param \core\event\base $event
+ * @return bool
+ */
+ abstract protected function is_event_ignored(\core\event\base $event);
+
+ /**
+ * Write event in the store with buffering. Method insert_event_entries() must be
* defined.
*
* @param \core\event\base $event
* @return void
*/
public function write(\core\event\base $event) {
- $this->buffer[] = $event;
+ if ($this->is_event_ignored($event)) {
+ return;
+ }
+
+ // We need to capture current info at this moment,
+ // at the same time this lowers memory use because
+ // snapshots and custom objects may be garbage collected.
+ $entry = $event->get_data();
+ $entry['other'] = serialize($entry['other']);
+ if (CLI_SCRIPT) {
+ $entry['origin'] = 'cli';
+ $entry['ip'] = null;
+ } else {
+ $entry['origin'] = 'web';
+ $entry['ip'] = getremoteaddr();
+ }
+ $entry['realuserid'] = \core\session\manager::is_loggedinas() ? $_SESSION['USER']->realuser : null;
+
+
+ $this->buffer[] = $entry;
$this->count++;
if (!isset($this->buffersize)) {
$events = $this->buffer;
$this->count = 0;
$this->buffer = array();
- $this->insert_events($events);
+ $this->insert_event_entries($events);
}
/**
* Bulk write a given array of events to the backend. Stores must implement this.
*
- * @param array $events An array of events to write.
+ * @param array $evententries raw event data
*/
- abstract protected function insert_events($events);
+ abstract protected function insert_event_entries($evententries);
/**
* Get a config value for the store.
return true;
}
+ /**
+ * Should the event be ignored (== not logged)?
+ * @param \core\event\base $event
+ * @return bool
+ */
+ protected function is_event_ignored(\core\event\base $event) {
+ if (in_array($event->crud, $this->excludeactions) ||
+ in_array($event->edulevel, $this->excludelevels)
+ ) {
+ // Ignore event if the store settings do not want to store it.
+ return true;
+ }
+ if ((!CLI_SCRIPT or PHPUNIT_TEST) and !$this->logguests) {
+ // Always log inside CLI scripts because we do not login there.
+ if (!isloggedin() or isguestuser()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Insert events in bulk to the database.
*
- * @param \core\event\base[] $events
+ * @param array $evententries raw event data
*/
- protected function insert_events($events) {
+ protected function insert_event_entries($evententries) {
if (!$this->init()) {
return;
}
if (!$dbtable = $this->get_config('dbtable')) {
return;
}
- $dataobj = array();
-
- // Filter events.
- foreach ($events as $event) {
- if (in_array($event->crud, $this->excludeactions) ||
- in_array($event->edulevel, $this->excludelevels)
- ) {
- // Ignore event if the store settings do not want to store it.
- continue;
- }
- if ((!CLI_SCRIPT or PHPUNIT_TEST) and !$this->logguests) {
- // Always log inside CLI scripts because we do not login there.
- if (!isloggedin() or isguestuser()) {
- continue;
- }
- }
-
- $data = $event->get_data();
- $data['other'] = serialize($data['other']);
- if (CLI_SCRIPT) {
- $data['origin'] = 'cli';
- $data['ip'] = null;
- } else {
- $data['origin'] = 'web';
- $data['ip'] = getremoteaddr();
- }
- $data['realuserid'] = \core\session\manager::is_loggedinas() ? $_SESSION['USER']->realuser : null;
- $dataobj[] = $data;
- }
try {
- $this->extdb->insert_records($dbtable, $dataobj);
+ $this->extdb->insert_records($dbtable, $evententries);
} catch (\moodle_exception $e) {
debugging('Cannot write to external database: ' . $e->getMessage(), DEBUG_DEVELOPER);
}
$this->logguests = $this->get_config('logguests', 1);
}
+ /**
+ * Should the event be ignored (== not logged)?
+ * @param \core\event\base $event
+ * @return bool
+ */
+ protected function is_event_ignored(\core\event\base $event) {
+ if ((!CLI_SCRIPT or PHPUNIT_TEST) and !$this->logguests) {
+ // Always log inside CLI scripts because we do not login there.
+ if (!isloggedin() or isguestuser()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Finally store the events into the database.
*
- * @param \core\event\base[] $events
+ * @param array $evententries raw event data
*/
- protected function insert_events($events) {
+ protected function insert_event_entries($evententries) {
global $DB;
- $dataobj = array();
-
- // Filter events.
- foreach ($events as $event) {
- if ((!CLI_SCRIPT or PHPUNIT_TEST) and !$this->logguests) {
- // Always log inside CLI scripts because we do not login there.
- if (!isloggedin() or isguestuser()) {
- continue;
- }
- }
-
- $data = $event->get_data();
- $data['other'] = serialize($data['other']);
- if (CLI_SCRIPT) {
- $data['origin'] = 'cli';
- $data['ip'] = null;
- } else {
- $data['origin'] = 'web';
- $data['ip'] = getremoteaddr();
- }
- $data['realuserid'] = \core\session\manager::is_loggedinas() ? $_SESSION['USER']->realuser : null;
- $dataobj[] = $data;
- }
-
- $DB->insert_records('logstore_standard_log', $dataobj);
+ $DB->insert_records('logstore_standard_log', $evententries);
}
public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum) {
I need to be able to upload a CSV file and navigate through the import process
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| First course | C1 | 0 |
And I log in as "admin"
- And I expand "Site administration" node
- And I expand "Courses" node
- And I follow "Upload courses"
+ And I navigate to "Upload courses" node in "Site administration > Courses"
@javascript
Scenario: Creation of unexisting courses
I need to be able to upload a CSV file and navigate through the import process
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Some random name | C1 | 0 |
And I log in as "admin"
- And I expand "Site administration" node
- And I expand "Courses" node
- And I follow "Upload courses"
+ And I navigate to "Upload courses" node in "Site administration > Courses"
@javascript
Scenario: Updating a course fullname
// Wait for the homepage to be ready.
$this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
+ // If it is needed, it expands the navigation bar with the 'Log in' link.
+ if ($clicknavbar = $this->get_expand_navbar_step()) {
+ array_unshift($steps, $clicknavbar);
+ }
+
+ return $steps;
+ }
+
+ /**
+ * Logs out of the system.
+ *
+ * @Given /^I log out$/
+ */
+ public function i_log_out() {
+
+ $steps = array(new When('I follow "' . get_string('logout') . '"'));
+
+ // No need to check anything else if we run without JS.
+ if (!$this->running_javascript()) {
+ return $steps;
+ }
+
+ // If it is needed, it expands the navigation bar with the 'Log out' link.
+ if ($clicknavbar = $this->get_expand_navbar_step()) {
+ array_unshift($steps, $clicknavbar);
+ }
+
+ return $steps;
+ }
+
+ /**
+ * Returns a step to open the navigation bar if it is needed.
+ *
+ * The top log in and log out links are hidden when middle or small
+ * size windows (or devices) are used. This step returns a step definition
+ * clicking to expand the navbar if it is hidden.
+ *
+ * @return Given|bool A step definition or false if there is no need to show the navbar.
+ */
+ protected function get_expand_navbar_step() {
+
// Checking if we need to click the navbar button to show the navigation menu, it
- // is hidden by default when using clean theme and a medium or small size screen size.
+ // is hidden by default when using clean theme and a medium or small screen size.
// The DOM and the JS should be all ready and loaded. Running without spinning
// as this is a widely used step and we can not spend time here trying to see
)";
// Adding an extra click we need to show the 'Log in' link.
- if ($this->getSession()->getDriver()->evaluateScript($navbuttonjs)) {
- array_unshift($steps, new Given('I click on ".btn-navbar" "css_element"'));
+ if (!$this->getSession()->getDriver()->evaluateScript($navbuttonjs)) {
+ return false;
}
- return $steps;
- }
-
- /**
- * Logs out of the system.
- *
- * @Given /^I log out$/
- */
- public function i_log_out() {
- return new When('I follow "' . get_string('logout') . '"');
+ return new Given('I click on ".btn-navbar" "css_element"');
}
-
}
Scenario: Log in with the predefined admin user with Javascript disabled
Given I log in as "admin"
- Then I should see "You are logged in as Admin User"
+ Then I should see "You are logged in as Admin User" in the "page-footer" "region"
@javascript
Scenario: Log in with the predefined admin user with Javascript enabled
Given I log in as "admin"
- Then I should see "You are logged in as Admin User"
+ Then I should see "You are logged in as Admin User" in the "page-footer" "region"
Scenario: Log in as an existing admin user filling the form
- Given the following "users" exists:
+ Given the following "users" exist:
| username | password | firstname | lastname | email |
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
And I am on homepage
And I set the field "Username" to "testuser"
And I set the field "Password" to "testuser"
And I press "Log in"
- Then I should see "You are logged in as"
+ Then I should see "You are logged in as" in the "page-footer" "region"
Scenario: Log in as an unexisting user filling the form
- Given the following "users" exists:
+ Given the following "users" exist:
| username | password | firstname | lastname | email |
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
And I am on homepage
Scenario: Log out
Given I log in as "admin"
When I log out
- Then I should see "You are not logged in"
+ Then I should see "You are not logged in" in the "page-footer" "region"
'timecreated' => $file->timecreated,
'timemodified'=> $file->timemodified,
'userid' => $mappeduserid,
+ 'source' => $file->source,
'author' => $file->author,
'license' => $file->license,
'sortorder' => $file->sortorder
I need to create backups of courses
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | numsections |
| Course 1 | C1 | 0 | 10 |
| Course 2 | C2 | 0 | 2 |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | course | idnumber | name | intro | section |
| assign | C2 | assign1 | Test assign | Assign description | 1 |
| data | C2 | data1 | Test data | Database description | 2 |
And I should not see "Section 3"
And I press "Continue"
And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
- And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exists
- And "Include course logs" "checkbox" should exists
+ And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exist
+ And "Include course logs" "checkbox" should exist
And I press "Next"
@javascript
@javascript
Scenario: Duplicate an activity
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
@javascript
Scenario: Import course's contents to another course
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
I need to restore them inside other Moodle courses or in new courses
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | format | numsections | coursedisplay |
| Course 1 | C1 | 0 | topics | 15 | 1 |
| Course 2 | C2 | 0 | topics | 5 | 0 |
| Course 3 | C3 | 0 | topics | 2 | 0 |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | course | idnumber | name | intro | section |
| assign | C3 | assign1 | Test assign name | Assign description | 1 |
| data | C3 | data1 | Test database name | Database description | 2 |
@javascript
Scenario: Award profile badge
Given I log in as "admin"
- And I expand "Site administration" node
- And I expand "Badges" node
- And I follow "Add a new badge"
+ And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Profile Badge |
| Description | Test badge description |
@javascript
Scenario: Award site badge
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher | teacher | 1 | teacher1@asd.com |
| student | student | 1 | student1@asd.com |
And I log in as "admin"
- And I expand "Site administration" node
- And I expand "Badges" node
- And I follow "Add a new badge"
+ And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
@javascript
Scenario: Award course badge
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Award badge on activity completion
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Award badge on course completion
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
Background:
Given I log in as "admin"
- And I expand "Site administration" node
- And I expand "Plugins" node
- And I expand "Activity modules" node
- And I follow "Manage activities"
+ And I navigate to "Manage activities" node in "Site administration > Plugins > Activity modules"
And I click on "//a[@title=\"Show\"]" "xpath_element" in the "Feedback" "table_row"
Scenario: Add activities block on the frontpage
- Given the following "activities" exists:
+ Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Frontpage assignment name | Frontpage assignment description | Acceptance test site | assign0 |
| book | Frontpage book name | Frontpage book description | Acceptance test site | book0 |
And I should see "Frontpage url name"
Scenario: Add activities block in a course
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Test assignment name | Test assignment description | C1 | assign1 |
| book | Test book name | Test book description | C1 | book1 |
In need to add comments to courses
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Delete comments with Javascript enabled
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
I need my courses displayed in the navigation block
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
- And the following "categories" exists:
+ And the following "categories" exist:
| name | category | idnumber |
| cat1 | 0 | cat1 |
| cat2 | 0 | cat2 |
| cat31 | cat3 | cat31 |
| cat32 | cat3 | cat32 |
| cat33 | cat3 | cat33 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course1 | c1 | cat1 |
| Course2 | c2 | cat2 |
| Course32 | c32 | cat32 |
| Course331| c331 | cat33 |
| Course332| c332 | cat33 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | c1 | student |
| student1 | c31 | student |
I need to add blocks to pages
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
@javascript
Scenario: Add and configure a block throughtout the site
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| manager1 | Manager | 1 | manager1@asd.com |
- And the following "system role assigns" exists:
+ And the following "system role assigns" exist:
| user | course | role |
| manager1 | Acceptance test site | manager |
And I log in as "manager1"
I need to add and modify block configuration for the page
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
- And I expand "Site administration" node
- And I expand "Appearance" node
- And I expand "Themes" node
- And I follow "Theme selector"
+ And I navigate to "Theme selector" node in "Site administration > Appearance > Themes"
And I click on "Change theme" "button" in the "Default" "table_row"
And I click on "Use theme" "button" in the "Afterburner" "table_row"
And I press "Continue"
I need to restrict some blocks to be used in courses
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: Add and configure a block to display on every page and revert back
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I press "Save changes"
And I should see "Tags" in the "Tags" "block"
And I follow "Course 1"
- And "Tags" "block" should not exists
+ And "Tags" "block" should not exist
And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element"
- And "Tags" "block" should not exists
+ And "Tags" "block" should not exist
And I follow "Course 1"
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Assignment2 |
I need to be able to comment on a blog entry
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| testuser | Test | User | moodle@moodlemoodle.com |
| testuser2 | Test2 | User2 | moodle2@moodlemoodle.com |
I need to create calendar data
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "admin"
I need to create cohorts and add users on them
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@user.com |
| user2 | Second | User | second@user.com |
| user3 | Third | User | third@user.com |
| user4 | Forth | User | forth@user.com |
And I log in as "admin"
- And I collapse "Front page settings" node
- And I expand "Site administration" node
- And I expand "Users" node
- And I expand "Accounts" node
- And I follow "Cohorts"
+ And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
And I press "Add"
And I set the following fields to these values:
| Name | Test cohort name |
// With JS enabled we should expand a few tree nodes.
if ($this->running_javascript()) {
+ $parentnodes = get_string('administrationsite') . ' > ' .
+ get_string('users', 'admin') . ' > ' .
+ get_string('accounts', 'admin');
$steps = array_merge(
array(
new Given('I am on homepage'),
- new Given('I collapse "' . get_string('frontpagesettings', 'admin') . '" node'),
- new Given('I expand "' . get_string('administrationsite') . '" node'),
- new Given('I expand "' . get_string('users', 'admin') . '" node'),
- new Given('I expand "' . get_string('accounts', 'admin') . '" node'),
- new Given('I follow "' . get_string('cohorts', 'cohort') . '"')
+ new Given('I navigate to "' . get_string('cohorts', 'cohort') . '" node in "' . $parentnodes . '"')
),
$steps
);
@javascript
Scenario: Upload users and assign them to a course with cohort enrolment method enabled
- Given the following "cohorts" exists:
+ Given the following "cohorts" exist:
| name | idnumber |
| Cohort 1 | ASD |
| Cohort 2 | DSA |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And I follow "Course 2"
And I add "Cohort sync" enrolment method with:
| Cohort | Cohort 2 |
- And I collapse "Course administration" node
- And I expand "Site administration" node
- And I expand "Users" node
- And I expand "Accounts" node
- When I follow "Upload users"
+ When I navigate to "Upload users" node in "Site administration > Users > Accounts"
And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filemanager
And I press "Upload users"
And I press "Upload users"
* type, criteria, requirement, status
*/
public function get_details($completion) {
- global $DB, $CFG;
-
// Get completion info
- $course = new stdClass();
- $course->id = $completion->course;
- $info = new completion_info($course);
-
- $module = $DB->get_record('course_modules', array('id' => $this->moduleinstance));
- $data = $info->get_data($module, false, $completion->userid);
-
- $activity = $DB->get_record($this->module, array('id' => $module->instance));
+ $modinfo = get_fast_modinfo($completion->course);
+ $cm = $modinfo->get_cm($this->moduleinstance);
$details = array();
$details['type'] = $this->get_title();
- $details['criteria'] = '<a href="'.$CFG->wwwroot.'/mod/'.$this->module.'/view.php?id='.$this->moduleinstance.'">'.$activity->name.'</a>';
+ if ($cm->has_view()) {
+ $details['criteria'] = html_writer::link($cm->url, $cm->get_formatted_name());
+ } else {
+ $details['criteria'] = $cm->get_formatted_name();
+ }
// Build requirements
$details['requirement'] = array();
- if ($module->completion == 1) {
+ if ($cm->completion == COMPLETION_TRACKING_MANUAL) {
$details['requirement'][] = get_string('markingyourselfcomplete', 'completion');
- } elseif ($module->completion == 2) {
- if ($module->completionview) {
+ } elseif ($cm->completion == COMPLETION_TRACKING_AUTOMATIC) {
+ if ($cm->completionview) {
$details['requirement'][] = get_string('viewingactivity', 'completion', $this->module);
}
- if (!is_null($module->completiongradeitemnumber)) {
+ if (!is_null($cm->completiongradeitemnumber)) {
$details['requirement'][] = get_string('achievinggrade', 'completion');
}
}
@javascript
Scenario: Mark an activity as completed
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
I need to set allow access dates to restrict activity access
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Show activity greyed-out to students when grade condition is not satisfied
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
I need to restrict sections availability using different conditions
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@asd.com |
| student1 | Student | First | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
}
}
+ require_once($CFG->libdir.'/grade/grade_outcome.php');
// Add outcomes if requested.
if ($hasoutcomes && $outcomes = grade_outcome::fetch_all_available($course->id)) {
$grade_items = array();
@javascript
Scenario: Open the action menu with a block docked
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
@javascript
Scenario: Groups mode toggle with javascript enabled
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
| Group mode | No groups |
| Force group mode | No |
When I press "Save changes"
- Then "No groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exists
+ Then "No groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exist
And I click on "No groups (Click to change)" "link" in the "Test forum name" activity
- And "Separate groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exists
+ And "Separate groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exist
And I reload the page
- And "Separate groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exists
+ And "Separate groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groups')]" "xpath_element" should exist
And I click on "Separate groups (Click to change)" "link" in the "Test forum name" activity
- And "Visible groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exists
+ And "Visible groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exist
And I reload the page
- And "Visible groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exists
+ And "Visible groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groupv')]" "xpath_element" should exist
And I click on "Visible groups (Click to change)" "link" in the "Test forum name" activity
- And "No groups (Click to change)" "link" should exists
- And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exists
+ And "No groups (Click to change)" "link" should exist
+ And "//a/child::img[contains(@src, 'groupn')]" "xpath_element" should exist
@javascript
Scenario: Indent course items with Javascript enabled
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| Name | Test glossary name |
| Description | Test glossary description |
When I indent right "Test glossary name" activity
- Then "#section-1 li.glossary div.mod-indent-1" "css_element" should exists
+ Then "#section-1 li.glossary div.mod-indent-1" "css_element" should exist
And I indent right "Test glossary name" activity
- And "//li[@id='section-1']/descendant::li[contains(concat(' ', @class, ' '), ' glossary ')]/descendant::a[not(contains(concat(' ', @class, ' '), ' hidden '))]/descendant::span[normalize-space(.)='Move left']" "xpath_element" should exists
- And "#section-1 li.glossary div.mod-indent-2" "css_element" should exists
+ And "//li[@id='section-1']/descendant::li[contains(concat(' ', @class, ' '), ' glossary ')]/descendant::a[not(contains(concat(' ', @class, ' '), ' hidden '))]/descendant::span[normalize-space(.)='Move left']" "xpath_element" should exist
+ And "#section-1 li.glossary div.mod-indent-2" "css_element" should exist
And I reload the page
- And "#section-1 li.glossary div.mod-indent-2" "css_element" should exists
+ And "#section-1 li.glossary div.mod-indent-2" "css_element" should exist
And I indent left "Test glossary name" activity
And I indent left "Test glossary name" activity
- And "#section-1 li.glossary div.mod-indent-2" "css_element" should not exists
- And "#section-1 li.glossary div.mod-indent-1" "css_element" should not exists
- And "//li[@id='section-1']/descendant::li[contains(concat(' ', @class, ' '), ' glossary ')]/descendant::a[not(contains(concat(' ', @class, ' '), ' hidden '))]/descendant::span[normalize-space(.)='Move left']" "xpath_element" should not exists
+ And "#section-1 li.glossary div.mod-indent-2" "css_element" should not exist
+ And "#section-1 li.glossary div.mod-indent-1" "css_element" should not exist
+ And "//li[@id='section-1']/descendant::li[contains(concat(' ', @class, ' '), ' glossary ')]/descendant::a[not(contains(concat(' ', @class, ' '), ' hidden '))]/descendant::span[normalize-space(.)='Move left']" "xpath_element" should not exist
@javascript
Scenario: Hide/Show toggle with javascript enabled
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Activities can be shown and hidden inside a hidden section
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | numsections |
| Course 1 | C1 | topics | 2 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
@javascript
Scenario: Activities can be shown and hidden inside an orphaned section
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | numsections |
| Course 1 | C1 | topics | 2 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to add activites to a course
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
if ($this->is_course_editor()) {
- // The activity should exists.
+ // The activity should exist.
$activitynode = $this->get_activity_node($activityname);
// Should be hidden.
} else {
- // It should not exists at all.
+ // It should not exist at all.
try {
$this->find_link($activityname);
throw new ExpectationException('The "' . $activityname . '" should not appear');
/**
* Clicks on the specified element of the activity. You should be in the course page with editing mode turned on.
*
- * @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" in the "(?P<activity_name_string>[^"]*)" activity$/
+ * @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<activity_name_string>(?:[^"]|\\")*)" activity$/
* @param string $element
* @param string $selectortype
* @param string $activityname
/**
* Clicks on a category in the management interface.
*
- * @Given /^I click on category "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I click on category "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_click_on_category_in_the_management_interface($name) {
/**
* Clicks on a course in the management interface.
*
- * @Given /^I click on course "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I click on course "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_click_on_course_in_the_management_interface($name) {
/**
* Clicks on a category checkbox in the management interface, if not checked.
*
- * @Given /^I select category "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I select category "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_select_category_in_the_management_interface($name) {
/**
* Clicks on a category checkbox in the management interface, if checked.
*
- * @Given /^I unselect category "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I unselect category "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_unselect_category_in_the_management_interface($name) {
/**
* Clicks course checkbox in the management interface, if not checked.
*
- * @Given /^I select course "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I select course "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_select_course_in_the_management_interface($name) {
/**
* Clicks course checkbox in the management interface, if checked.
*
- * @Given /^I unselect course "(?P<name>[^"]*)" in the management interface$/
+ * @Given /^I unselect course "(?P<name_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $name
*/
public function i_unselect_course_in_the_management_interface($name) {
/**
* Move selected categories to top level in the management interface.
*
- * @Given /^I move category "(?P<name>[^"]*)" to top level in the management interface$/
+ * @Given /^I move category "(?P<name_string>(?:[^"]|\\")*)" to top level in the management interface$/
* @param string $name
* @return Given[]
*/
/**
* Checks that a category is a subcategory of specific category.
*
- * @Given /^I should see category "(?P<subcatidnumber>[^"]*)" as subcategory of "(?P<catidnumber>[^"]*)" in the management interface$/
+ * @Given /^I should see category "(?P<subcatidnumber_string>(?:[^"]|\\")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|\\")*)" in the management interface$/
* @throws ExpectationException
* @param string $subcatidnumber
* @param string $catidnumber
/**
* Checks that a category is not a subcategory of specific category.
*
- * @Given /^I should not see category "(?P<subcatidnumber>[^"]*)" as subcategory of "(?P<catidnumber>[^"]*)" in the management interface$/
+ * @Given /^I should not see category "(?P<subcatidnumber_string>(?:[^"]|\\")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|\\")*)" in the management interface$/
* @throws ExpectationException
* @param string $subcatidnumber
* @param string $catidnumber
/**
* Click to expand a category revealing its sub categories within the management UI.
*
- * @Given /^I click to expand category "(?P<idnumber>[^"]*)" in the management interface$/
+ * @Given /^I click to expand category "(?P<idnumber_string>(?:[^"]|\\")*)" in the management interface$/
* @param string $idnumber
*/
public function i_click_to_expand_category_in_the_management_interface($idnumber) {
/**
* Checks that a category within the management interface is visible.
*
- * @Given /^category in management listing should be visible "(?P<idnumber>[^"]*)"$/
+ * @Given /^category in management listing should be visible "(?P<idnumber_string>(?:[^"]|\\")*)"$/
* @param string $idnumber
*/
public function category_in_management_listing_should_be_visible($idnumber) {
/**
* Checks that a category within the management interface is dimmed.
*
- * @Given /^category in management listing should be dimmed "(?P<idnumber>[^"]*)"$/
+ * @Given /^category in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|\\")*)"$/
* @param string $idnumber
*/
public function category_in_management_listing_should_be_dimmed($idnumber) {
/**
* Checks that a course within the management interface is visible.
*
- * @Given /^course in management listing should be visible "(?P<idnumber>[^"]*)"$/
+ * @Given /^course in management listing should be visible "(?P<idnumber_string>(?:[^"]|\\")*)"$/
* @param string $idnumber
*/
public function course_in_management_listing_should_be_visible($idnumber) {
/**
* Checks that a course within the management interface is dimmed.
*
- * @Given /^course in management listing should be dimmed "(?P<idnumber>[^"]*)"$/
+ * @Given /^course in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|\\")*)"$/
* @param string $idnumber
*/
public function course_in_management_listing_should_be_dimmed($idnumber) {
*
* If it was visible it will be hidden. If it is hidden it will be made visible.
*
- * @Given /^I toggle visibility of course "(?P<idnumber>[^"]*)" in management listing$/
+ * @Given /^I toggle visibility of course "(?P<idnumber_string>(?:[^"]|\\")*)" in management listing$/
* @param string $idnumber
*/
public function i_toggle_visibility_of_course_in_management_listing($idnumber) {
*
* If it was visible it will be hidden. If it is hidden it will be made visible.
*
- * @Given /^I toggle visibility of category "(?P<idnumber>[^"]*)" in management listing$/
+ * @Given /^I toggle visibility of category "(?P<idnumber_string>(?:[^"]|\\")*)" in management listing$/
*/
public function i_toggle_visibility_of_category_in_management_listing($idnumber) {
$id = $this->get_category_id($idnumber);
/**
* Moves a category displayed in the management interface up or down one place.
*
- * @Given /^I click to move category "(?P<idnumber>[^"]*)" (?P<direction>up|down) one$/
+ * @Given /^I click to move category "(?P<idnumber_string>(?:[^"]|\\")*)" (?P<direction>up|down) one$/
*
* @param string $idnumber The category idnumber
* @param string $direction The direction to move in, either up or down
/**
* Moves a course displayed in the management interface up or down one place.
*
- * @Given /^I click to move course "(?P<idnumber>[^"]*)" (?P<direction>up|down) one$/
+ * @Given /^I click to move course "(?P<idnumber_string>(?:[^"]|\\")*)" (?P<direction>up|down) one$/
*
* @param string $idnumber The course idnumber
* @param string $direction The direction to move in, either up or down
/**
* Check that one course appears before another in the course category management listings.
*
- * @Given /^I should see course listing "(?P<preceedingcourse>[^"]*)" before "(?P<followingcourse>[^"]*)"$/
+ * @Given /^I should see course listing "(?P<preceedingcourse_string>(?:[^"]|\\")*)" before "(?P<followingcourse_string>(?:[^"]|\\")*)"$/
*
* @param string $preceedingcourse The first course to find
* @param string $followingcourse The second course to find (should be AFTER the first course)
/**
* Check that one category appears before another in the course category management listings.
*
- * @Given /^I should see category listing "(?P<preceedingcategory>[^"]*)" before "(?P<followingcategory>[^"]*)"$/
+ * @Given /^I should see category listing "(?P<preceedingcategory_string>(?:[^"]|\\")*)" before "(?P<followingcategory_string>(?:[^"]|\\")*)"$/
*
* @param string $preceedingcategory The first category to find
* @param string $followingcategory The second category to find (should be after the first category)
/**
* Checks that we are on the course management page that we expect to be on and that no course has been selected.
*
- * @Given /^I should see the "(?P<mode>[^"]*)" management page$/
+ * @Given /^I should see the "(?P<mode_string>(?:[^"]|\\")*)" management page$/
* @param string $mode The mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses'
* @return Given[]
*/
);
switch ($mode) {
case "Courses":
- $return[] = new Given('"#category-listing" "css_element" should not exists');
- $return[] = new Given('"#course-listing" "css_element" should exists');
+ $return[] = new Given('"#category-listing" "css_element" should not exist');
+ $return[] = new Given('"#course-listing" "css_element" should exist');
break;
case "Course categories":
- $return[] = new Given('"#category-listing" "css_element" should exists');
- $return[] = new Given('"#course-listing" "css_element" should not exists');
+ $return[] = new Given('"#category-listing" "css_element" should exist');
+ $return[] = new Given('"#course-listing" "css_element" should not exist');
break;
case "Courses categories and courses":
default:
- $return[] = new Given('"#category-listing" "css_element" should exists');
- $return[] = new Given('"#course-listing" "css_element" should exists');
+ $return[] = new Given('"#category-listing" "css_element" should exist');
+ $return[] = new Given('"#course-listing" "css_element" should exist');
break;
}
- $return[] = new Given('"#course-detail" "css_element" should not exists');
+ $return[] = new Given('"#course-detail" "css_element" should not exist');
return $return;
}
/**
* Checks that we are on the course management page that we expect to be on and that a course has been selected.
*
- * @Given /^I should see the "(?P<mode>[^"]*)" management page with a course selected$/
+ * @Given /^I should see the "(?P<mode_string>(?:[^"]|\\")*)" management page with a course selected$/
* @param string $mode The mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses'
* @return Given[]
*/
public function i_should_see_the_courses_management_page_with_a_course_selected($mode) {
$return = $this->i_should_see_the_courses_management_page($mode);
array_pop($return);
- $return[] = new Given('"#course-detail" "css_element" should exists');
+ $return[] = new Given('"#course-detail" "css_element" should exist');
return $return;
}
/**
* Locates a course in the course category management interface and then triggers an action for it.
*
- * @Given /^I click on "(?P<action>[^"]*)" action for "(?P<name>[^"]*)" in management course listing$/
+ * @Given /^I click on "(?P<action_string>(?:[^"]|\\")*)" action for "(?P<name_string>(?:[^"]|\\")*)" in management course listing$/
*
* @param string $action The action to take. One of
* @param string $name The name of the course as it is displayed in the management interface.
/**
* Locates a category in the course category management interface and then triggers an action for it.
*
- * @Given /^I click on "(?P<action>[^"]*)" action for "(?P<name>[^"]*)" in management category listing$/
+ * @Given /^I click on "(?P<action_string>(?:[^"]|\\")*)" action for "(?P<name_string>(?:[^"]|\\")*)" in management category listing$/
*
* @param string $action The action to take. One of
* @param string $name The name of the category as it is displayed in the management interface.
/**
* Clicks on a category in the management interface.
*
- * @Given /^I click on "([^"]*)" category in the management category listing$/
+ * @Given /^I click on "(?P<categoryname_string>(?:[^"]|\\")*)" category in the management category listing$/
* @param string $name The name of the category to click.
*/
public function i_click_on_category_in_the_management_category_listing($name) {
# Tests hiding and then showing a single category.
Scenario: Test making a category hidden and then visible again.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
# Tests hiding and then showing a single category.
@javascript
Scenario: Test using AJAX to make a category hidden and then visible again.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
# Tests hiding and then showing a subcategory.
Scenario: Test making a subcategory hidden and then visible again.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | CAT1 | CAT2 |
# Tests hiding and then showing a subcategory.
@javascript
Scenario: Test using AJAX to make a subcategory hidden and then visible again.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | CAT1 | CAT2 |
# The test below this is identical except with JavaScript enabled.
Scenario: Test relation between category and course when changing visibility.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | CAT1 | CAT3 |
| Cat 4 | CAT1 | CAT4 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
# The test above this is identical except without JavaScript enabled.
@javascript @_cross_browser
Scenario: Test the relation between category and course when changing visibility with AJAX
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | CAT1 | CAT3 |
| Cat 4 | CAT1 | CAT4 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
@javascript @_cross_browser
Scenario: Test courses are hidden when selected category parent is hidden.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | CAT1 | CAT2 |
| Cat 3 | CAT2 | CAT3 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT3 | Course 1 | Course 1 | C1 |
Test we can manage filters for a category
Scenario: Test editing a category through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
And I should see "Category 1 (edited)" in the "#course-listing h3" "css_element"
Scenario: Test deleting a categories through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | 0 | CAT3 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT3 | Course 1 | Course 1 | C1 |
And I should see "Course 1" in the "#course-listing ul.ml" "css_element"
Scenario: Test I can assign roles for a category through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
And I should see "Cat 1" in the "#course-listing h3" "css_element"
Scenario: Test I can set access permissions for a category through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
And I should see "Cat 1" in the "#course-listing h3" "css_element"
Scenario: Test clicking to manage cohorts for a category through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
And I should see "Category: Cat 1: available cohorts"
Scenario: Test configuring filters for a category
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
@javascript
Scenario: Test that I can create a category and view it in the management interface
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And I log in as "admin"
@javascript
Scenario: Test moving a categories through the management interface.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
@javascript
Scenario: Test bulk action is shown only when some category/course is selected
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | 0 | CAT3 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT3 | Course 1 | Course 1 | C1 |
| CAT3 | Course 2 | Course 2 | C2 |
I need to test we can manually sort categories.
Scenario Outline: Test bulk sorting all categories.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Social studies | Ext003 | 1 |
| 0 | Applied sciences | Sci001 | 2 |
| "Sort categories by ID number" | "Extended social studies" | "Social studies" | "Applied sciences" |
Scenario Outline: Test bulk sorting current category.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Test category | Tes001 | 1 |
| Tes001 | Social studies | Ext003 | 2 |
| "Sort categories by ID number" | "Extended social studies" | "Social studies" | "Applied sciences" |
Scenario Outline: Test resorting subcategories.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Master cat | CAT1 | 1 |
| CAT1 | Social studies | Ext003 | 1 |
@javascript
Scenario Outline: Test resorting subcategories with JS enabled.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Master cat | CAT1 | 1 |
| CAT1 | Social studies | Ext003 | 1 |
# The scenario below this is the same but with JS enabled.
Scenario: Test moving categories up and down by one.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | idnumber | name |
| 0 | CAT1 | Cat 1 |
| 0 | CAT2 | Cat 2 |
@javascript @_cross_browser
Scenario: Test using AJAX to move categories up and down by one.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | idnumber | name |
| 0 | CAT1 | Cat 1 |
| 0 | CAT2 | Cat 2 |
@javascript
Scenario: Test general look of management interface
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And I log in as "admin"
@javascript
Scenario: Test view mode functionality
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | CAT1 | topics |
And I should see "Cat 1" in the "#course-detail .category" "css_element"
Scenario: Test displaying of sub categories
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 1-1-2 | CAT3 | CAT6 |
| Cat 2-1 | CAT2 | CAT7 |
| Cat 2-1-1 | CAT7 | CAT8 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | CAT1 |
| Course 2 | C2 | CAT1 |
# to load the categories.
@javascript @_cross_browser
Scenario: Test AJAX loading of sub categories
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 1-1-2 | CAT3 | CAT6 |
| Cat 2-1 | CAT2 | CAT7 |
| Cat 2-1-1 | CAT7 | CAT8 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | CAT1 |
| Course 2 | C2 | CAT1 |
@javascript
Scenario Outline: Top level categories are displayed correctly when resorted
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Social studies | Ext003 | 1 |
| 0 | Applied sciences | Sci001 | 2 |
@javascript
Scenario Outline: Sub categories are displayed correctly when resorted
- Given the following "categories" exists:
+ Given the following "categories" exist:
| category | name | idnumber | sortorder |
| 0 | Master cat | CAT1 | 1 |
| CAT1 | Social studies | Ext003 | 1 |
@javascript
Scenario Outline: Test courses are displayed correctly after being resorted.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber | sortorder |
| CAT1 | Social studies | Senior school | Ext003 | 1 |
| CAT1 | Applied sciences | Middle school | Sci001 | 2 |
@javascript
Scenario: Test course pagination
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
And I should see course listing "Course 9" before "Course 10"
And I should see course listing "Course 10" before "Course 11"
And I should see course listing "Course 11" before "Course 12"
- And "#course-listing .listing-pagination" "css_element" should not exists
+ And "#course-listing .listing-pagination" "css_element" should not exist
And I click on "Per page: 20" "link" in the ".course-listing-actions" "css_element"
And I should see "5" in the ".courses-per-page" "css_element"
And I should see "10" in the ".courses-per-page" "css_element"
And I should not see "Course 10"
And I should not see "Course 11"
And I should not see "Course 12"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 1 to 5 of 12 courses"
And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
And I should not see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should see course listing "Course 9" before "Course 10"
And I should not see "Course 11"
And I should not see "Course 12"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 6 to 10 of 12 courses"
And I should see "First" in the "#course-listing .listing-pagination" "css_element"
And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should not see "Course 9" in the "#course-listing" "css_element"
And I should not see "Course 10" in the "#course-listing" "css_element"
And I should see course listing "Course 11" before "Course 12"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 11 to 12 of 12 courses"
And I should see "First" in the "#course-listing .listing-pagination" "css_element"
And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should not see "Course 10" in the "#course-listing" "css_element"
And I should not see "Course 11" in the "#course-listing" "css_element"
And I should not see "Course 12" in the "#course-listing" "css_element"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 1 to 5 of 12 courses"
And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
And I should not see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should not see "Course 9" in the "#course-listing" "css_element"
And I should not see "Course 10" in the "#course-listing" "css_element"
And I should see course listing "Course 11" before "Course 12"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 11 to 12 of 12 courses"
And I should see "First" in the "#course-listing .listing-pagination" "css_element"
And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should see course listing "Course 9" before "Course 10"
And I should not see "Course 11"
And I should not see "Course 12"
- And "#course-listing .listing-pagination" "css_element" should exists
+ And "#course-listing .listing-pagination" "css_element" should exist
And I should see "Showing courses 6 to 10 of 12 courses"
And I should see "First" in the "#course-listing .listing-pagination" "css_element"
And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
Scenario: Test pagination is only shown when required
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
And I should see course listing "Course 2" before "Course 3"
And I should see course listing "Course 3" before "Course 4"
And I should see course listing "Course 4" before "Course 5"
- And "#course-listing .listing-pagination" "css_element" should not exists
+ And "#course-listing .listing-pagination" "css_element" should not exist
And I click on "5" "link" in the ".course-listing-actions" "css_element"
# Redirect
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
And I should see course listing "Course 2" before "Course 3"
And I should see course listing "Course 3" before "Course 4"
And I should see course listing "Course 4" before "Course 5"
- And "#course-listing .listing-pagination" "css_element" should not exists
+ And "#course-listing .listing-pagination" "css_element" should not exist
# We need at least 30 courses for this next test.
@javascript
Scenario: Test many course pagination
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
And I should see course listing "Course 19" before "Course 20"
And I should see course listing "Course 21" before "Course 22"
And I should see course listing "Course 31" before "Course 32"
- And "#course-listing .listing-pagination" "css_element" should not exists
+ And "#course-listing .listing-pagination" "css_element" should not exist
And I click on "Per page: 100" "link" in the ".course-listing-actions" "css_element"
And I click on "5" "link" in the ".courses-per-page" "css_element"
# Redirect.
And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
Scenario: Test clicking to edit a course.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
@javascript
Scenario: Test AJAX expanded categories stay open.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
@javascript
Scenario: Test category expansion after deletion
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat A (1) | 0 | CAT1 |
| Cat B (2) | 0 | CAT2 |
# Test hiding and showing a course.
Scenario: Test toggling course visibility through the management interfaces.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
# Test hiding and showing a course with JS, same as the above test.
@javascript
Scenario: Test using AJAX to hide a course through the management interfaces.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
@javascript @_cross_browser
Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | coursedisplay | numsections |
| Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I press "Turn editing on"
Then I should see "Turn editing off"
And I press "Turn editing off"
- And "Turn editing on" "button" should exists
+ And "Turn editing on" "button" should exist
And I follow "Turn editing on"
- And "Turn editing off" "button" should exists
+ And "Turn editing off" "button" should exist
And I follow "Turn editing off"
And I should see "Turn editing on"
- And "Turn editing on" "button" should exists
+ And "Turn editing on" "button" should exist
And I turn editing mode on
And I click on "Actions" "link" in the "Recent activity" "block"
And I click on "Delete Recent activity block" "link"
And I press "Yes"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 1 |
| Description | Test forum description 1 |
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 2 |
| Description | Test forum description 2 |
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I indent right "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I indent left "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I open "Test forum name 1" actions menu
And I click on "Edit settings" "link" in the "Test forum name 1" activity
And I should see "Updating Forum"
| Description | Just to check that I can edit the description |
| Display description on course page | 1 |
And I click on "Cancel" "button"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I open "Test forum name 1" actions menu
And I click on "Hide" "link" in the "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I open "Test forum name 1" actions menu
And I delete "Test forum name 1" activity
And I should not see "Test forum name 1" in the "#region-main" "css_element"
And I duplicate "Test forum name 2" activity editing the new copy with:
| Forum name | Edited test forum name 2 |
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I should see "Test forum name 2"
And I should see "Edited test forum name 2"
And I hide section "1"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And section "1" should be hidden
And all activities in section "1" should be hidden
And I show section "1"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And section "1" should be visible
And I add the "Section links" block
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I should see "1 2 3 4 5" in the "Section links" "block"
And I click on "2" "link" in the "Section links" "block"
And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
| weeks | 1 | "Course 1" | should | should not |
Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | coursedisplay | numsections |
| Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I press "Turn editing on"
Then I should see "Turn editing off"
And I press "Turn editing off"
- And "Turn editing on" "button" should exists
+ And "Turn editing on" "button" should exist
And I follow "Turn editing on"
- And "Turn editing off" "button" should exists
+ And "Turn editing off" "button" should exist
And I follow "Turn editing off"
And I should see "Turn editing on"
- And "Turn editing on" "button" should exists
+ And "Turn editing on" "button" should exist
And I turn editing mode on
And I click on "Actions" "link" in the "Recent activity" "block"
And I click on "Delete Recent activity block" "link"
And I press "Yes"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 1 |
| Description | Test forum description 1 |
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 2 |
| Description | Test forum description 2 |
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I indent right "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I indent left "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I click on "Edit settings" "link" in the "Test forum name 1" activity
And I should see "Updating Forum"
And I should see "Display description on course page"
And I press "Save and return to course"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I click on "Hide" "link" in the "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I delete "Test forum name 1" activity
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I should not see "Test forum name 1" in the "#region-main" "css_element"
And I duplicate "Test forum name 2" activity editing the new copy with:
| Forum name | Edited test forum name 2 |
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I should see "Test forum name 2"
And I should see "Edited test forum name 2"
And I hide section "1"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And section "1" should be hidden
And all activities in section "1" should be hidden
And I show section "1"
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And section "1" should be visible
And I add the "Section links" block
- And "#section-2" "css_element" <should_see_other_sections> exists
+ And "#section-2" "css_element" <should_see_other_sections> exist
And I should see "1 2 3 4 5" in the "Section links" "block"
And I click on "2" "link" in the "Section links" "block"
And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
# Test resorting courses with
Scenario Outline: Resort courses.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber | sortorder |
| CAT1 | Social studies | Senior school | Ext003 | 1 |
| CAT1 | Applied sciences | Middle school | Sci001 | 2 |
@javascript
Scenario Outline: Resort courses with JavaScript enabled.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber | sortorder |
| CAT1 | Social studies | Senior school | Ext003 | 1 |
| CAT1 | Applied sciences | Middle school | Sci001 | 2 |
| "By idnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
Scenario: Test moving courses up and down by one.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
# Like the above test but with JavaScript enabled.
@javascript
Scenario: Test using AJAX to move courses up and down by one.
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
I need to test I can delete a course
Scenario: Create a course
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
And I should see "Test course: create a course" in the "#course-listing" "css_element"
Scenario: Delete a course via its management listing
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Test course: create a course | TCCAC | TC3401 |
| CAT1 | Test course 2: create another course | TC2CAC | TC3402 |
And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
Scenario: Delete a course via its management details page
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category 0| idnumber |
| Cat 1 | 0 | CAT1 |
- And the following "courses" exists:
+ And the following "courses" exist:
| category | fullname | shortname | idnumber |
| CAT1 | Test course: create a course | TCCAC | TC3401 |
| CAT1 | Test course 2: create another course | TC2CAC | TC3402 |
@javascript
Scenario: Edit course settings
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | summary | format |
| Course 1 | C1 | <p>Course summary</p> | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to force the group mode of all course's activities
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
| Group mode | Separate groups |
| Force group mode | Yes |
When I press "Save changes"
- Then "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists
- And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists
+ Then "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exist
+ And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exist
@javascript
Scenario: Forced group mode using visible groups
| Group mode | Visible groups |
| Force group mode | Yes |
And I press "Save changes"
- Then "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists
- And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists
+ Then "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exist
+ And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exist
@javascript
Scenario: Forced group mode without groups
| Group mode | No groups |
| Force group mode | Yes |
And I press "Save changes"
- Then "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists
- And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists
+ Then "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exist
+ And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exist
I need to set different frontpage display modes
Background:
- Given the following "categories" exists:
+ Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 2 child | CAT2 | CAT21 |
| Category 1 child child | CAT11 | CAT111 |
| Category 3 | 0 | CAT3 |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category |
| Course 1 1 | COURSE1_1 | CAT1 |
| Course 2 1 | COURSE2_1 | CAT2 |
I need to limit the number of weeks/topics a course can have
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| manager1 | Manager | 1 | manager1@asd.com |
- And the following "system role assigns" exists:
+ And the following "system role assigns" exist:
| user | course | role |
| manager1 | Acceptance test site | manager |
And I log in as "admin"
I need to move activities between sections
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | coursedisplay | numsections |
| Course 1 | C1 | topics | 0 | 5 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to move sections up and down
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | coursedisplay | numsections |
| Course 1 | C1 | topics | 0 | 5 |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
| Forum name | Test forum name |
| Description | Test forum description |
When I follow "Topic 2"
- Then "#section-1" "css_element" should not exists
- And "#section-3" "css_element" should not exists
- And "Move down" "link" should not exists
- And "Move up" "link" should not exists
+ Then "#section-1" "css_element" should not exist
+ And "#section-3" "css_element" should not exist
+ And "Move down" "link" should not exist
+ And "Move up" "link" should not exist
@javascript @_cross_browser
Scenario Outline: Weekly and topics course formats with Javascript enabled
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | format | coursedisplay | numsections |
| Course 1 | C1 | 0 | <courseformat> | 1 | 3 |
And I log in as "admin"
| weeks | "1 January - 7 January" | "8 January - 14 January" | "15 January - 21 January" | "25 December - 31 December" | "22 January - 28 January" |
Scenario Outline: Weekly and topics course formats with Javascript disabled
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | format | coursedisplay | numsections |
| Course 1 | C1 | 0 | <courseformat> | 1 | 3 |
And I log in as "admin"
@javascript
Scenario: Rename roles within a course
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| teacher2 | Teacher | 2 | teacher2@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | teacher |
I need to control which activities can be used in courses
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | 0 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario Outline: Highlight a topic's course section with course paged mode and without it
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format | coursedisplay |
| Course 1 | C1 | topics | <coursedisplay> |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Show / hide section icon functions correctly
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
* @param bool $buffer_if_future
*/
protected function process_records(progress_trace $trace, $action, $roleid, $user, $course, $timestart, $timeend, $buffer_if_future = true) {
- global $CFG, $DB, $SESSION;
+ global $CFG, $DB;
// Check if timestart is for future processing.
if ($timestart > time() and $buffer_if_future) {
}
if ($notify and $this->get_config('mailstudents')) {
- // Some nasty hackery to get strings and dates localised for target user.
- $sessionlang = isset($SESSION->lang) ? $SESSION->lang : null;
- if (get_string_manager()->translation_exists($user->lang, false)) {
- $SESSION->lang = $user->lang;
- moodle_setlocale();
- }
+ $oldforcelang = force_current_language($user->lang);
// Send welcome notification to enrolled users.
$a = new stdClass();
$trace->output("Failed to notify enrolled user", 1);
}
- if ($SESSION->lang !== $sessionlang) {
- $SESSION->lang = $sessionlang;
- moodle_setlocale();
- }
+ force_current_language($oldforcelang);
}
if ($notify and $this->get_config('mailteachers', 0)) {
// Notify person responsible for enrolments.
$enroller = $this->get_enroller($course->id);
- // Some nasty hackery to get strings and dates localised for target user.
- $sessionlang = isset($SESSION->lang) ? $SESSION->lang : null;
- if (get_string_manager()->translation_exists($enroller->lang, false)) {
- $SESSION->lang = $enroller->lang;
- moodle_setlocale();
- }
+ $oldforcelang = force_current_language($enroller->lang);
$a = new stdClass();
$a->course = format_string($course->fullname, true, array('context' => $context));
$trace->output("Failed to notify enroller {$eventdata->userto->id}", 1);
}
- if ($SESSION->lang !== $sessionlang) {
- $SESSION->lang = $sessionlang;
- moodle_setlocale();
- }
+ force_current_language($oldforcelang);
}
return;
I need to access courses as a guest
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
$mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
$mform->addHelpButton('enrolperiod', 'enrolperiod', 'enrol_paypal');
- $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_paypal'), array('optional' => true));
+ $mform->addElement('date_time_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_paypal'), array('optional' => true));
$mform->setDefault('enrolstartdate', 0);
$mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'enrol_paypal');
- $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_paypal'), array('optional' => true));
+ $mform->addElement('date_time_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_paypal'), array('optional' => true));
$mform->setDefault('enrolenddate', 0);
$mform->addHelpButton('enrolenddate', 'enrolenddate', 'enrol_paypal');
$mform->addHelpButton('expirythreshold', 'expirythreshold', 'core_enrol');
$mform->disabledIf('expirythreshold', 'expirynotify', 'eq', 0);
- $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_self'), array('optional' => true));
+ $mform->addElement('date_time_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_self'), array('optional' => true));
$mform->setDefault('enrolstartdate', 0);
$mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'enrol_self');
- $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_self'), array('optional' => true));
+ $mform->addElement('date_time_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_self'), array('optional' => true));
$mform->setDefault('enrolenddate', 0);
$mform->addHelpButton('enrolenddate', 'enrolenddate', 'enrol_self');
I need to auto enrol me in courses
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: Add legacy files
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | legacyfiles |
| Course 1 | C1 | 0 | 2 |
And I log in as "admin"
@javascript
Scenario: Add legacy file disabled
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | legacyfiles |
| Course 1 | C1 | 0 | 2 |
And I log in as "admin"
I need to edit previously used rubrics
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I follow "Course 1"
# Editing a rubric definition without regrading students.
And I go to "Test assignment 1 name" advanced grading definition page
- And "Save as draft" "button" should not exists
+ And "Save as draft" "button" should not exist
And I click on "Move up" "button" in the "Criterion 1" "table_row"
And I replace "Level 11" rubric level with "Level 11 edited" in "Criterion 1" criterion
And I press "Save"
I need to publish rubrics and make them available to all teachers
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| manager1 | Manager | 1 | manager1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "activities" exists:
+ And the following "activities" exist:
| activity | course | idnumber | name | intro | advancedgradingmethod_submissions |
| assign | C1 | A1 | Test assignment 1 name | TA1 | rubric |
| assign | C1 | A2 | Test assignment 2 name | TA2 | rubric |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
- And the following "system role assigns" exists:
+ And the following "system role assigns" exist:
| user | role | contextlevel | reference |
| manager1 | manager | System | |
And I log in as "manager1"
Scenario: Create a rubric template and reuse it as a teacher, with Javascript disabled
Then the field "Description" matches value "Assignment 1 description"
# Trying to avoid pointing by id or name as the code internals may change.
- And "//table[@class='criteria']//textarea[text()='Criterion 1']" "xpath_element" should exists
+ And "//table[@class='criteria']//textarea[text()='Criterion 1']" "xpath_element" should exist
And I press "Cancel"
I need to reuse rubrics that I created previously
Background:
- Given the following "users" exists:
+ Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "courses" exists:
+ And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to enable grade weightings and check that they are displayed correctly.
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
I need to create groups automatically and allocate them in groupings if necessary
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student0 | Student | 0 | student0@asd.com |
| student7 | Student | 7 | student7@asd.com |
| student8 | Student | 8 | student8@asd.com |
| student9 | Student | 9 | student9@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student0 | C1 | student |
@javascript
Scenario: Assign students to groups
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student0 | Student | 0 | student0@asd.com |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
| student3 | Student | 3 | student3@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student0 | C1 | student |
@javascript
Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
I need to create groups and groupings under different scenarios and check that the expected result occurs when attempting to delete them.
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to upload a file and verify groups and groupings can be imported
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
I need to create groups with unique identificators
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
I need to create groups and groupings under different scenarios and check that the expected result occurs when attempting to update them.
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
- And the following "users" exists:
+ And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
- And the following "course enrolments" exists:
+ And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
It is recommended to install local copy of free GeoLite City database from MaxMind.<br />
IP address location is displayed on simple map or using Google Maps. Please note that you need to have a Google account and apply for free Google Maps API key to enable interactive maps.';
$string['iplookupmaxmindnote'] = 'This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com/">http://www.maxmind.com/</a>.';
+$string['keeplogoutlang'] = 'Keep language on logout';
+$string['keeplogoutlang_desc'] = 'Enable this option to prevent the user interface language from reverting back to the site\'s default language when users log out.';
$string['keeptagnamecase'] = 'Keep tag name casing';
$string['lang'] = 'Default language';
$string['langcache'] = 'Cache language menu';
$string['enabled'] = 'Enabled';
$string['errorcallingprocessor'] = 'Error calling defined output';
$string['errortranslatingdefault'] = 'Error translating default setting provided by plugin, using system defaults instead.';
+$string['eventmessagecontactadded'] = 'Message contact added';
+$string['eventmessagecontactblocked'] = 'Message contact blocked';
+$string['eventmessagecontactremoved'] = 'Message contact removed';
+$string['eventmessagecontactunblocked'] = 'Message contact unblocked';
+$string['eventmessageread'] = 'Message read';
+$string['eventmessagesent'] = 'Message sent';
$string['forced'] = 'Forced';
$string['formorethan'] = 'For more than';
$string['guestnoeditmessage'] = 'Guest user can not edit messaging options';
$string['numqas'] = 'No. question attempts';
$string['numquestions'] = 'No. questions';
$string['numquestionsandhidden'] = '{$a->numquestions} (+{$a->numhidden} hidden)';
+$string['openpreviewfromform'] = '{$a} Preview';
$string['orphanedquestionscategory'] = 'Questions saved from deleted categories';
$string['orphanedquestionscategoryinfo'] = 'Occasionally, typically due to old software bugs, questions can remain in the database even though the corresponding question category has been deleted. Of course, this should not happen, it has happened in the past on this site. This category has been created automatically, and the orphaned questions moved here so that you can manage them. Note that any images or media files used by these questions have probably been lost.';
$string['page-question-x'] = 'Any question page';
$string['questionvariant'] = 'Question variant';
$string['reviewresponse'] = 'Review response';
$string['save'] = 'Save';
+$string['savechangesandcontinueediting'] = 'Save changes and continue editing';
$string['saveflags'] = 'Save the state of the flags';
$string['selectacategory'] = 'Select a category:';
$string['selectaqtypefordescription'] = 'Select a question type to see its description.';
$output = ob_get_contents();
ob_end_clean();
- if ($CFG->debugdeveloper && !empty($output)) {
- // Only throw an error if the site is in debugdeveloper.
- throw new coding_exception('Unexpected output whilst processing AJAX request. ' .
+ if (!empty($output)) {
+ $message = 'Unexpected output whilst processing AJAX request. ' .
'This could be caused by trailing whitespace. Output received: ' .
- var_export($output, true));
+ var_export($output, true);
+ if ($CFG->debugdeveloper && !empty($output)) {
+ // Only throw an error if the site is in debugdeveloper.
+ throw new coding_exception($message);
+ }
+ error_log('Potential coding error: ' . $message);
}
return $output;
}
* @param stdClass $user
*/
function login_lock_account($user) {
- global $CFG, $SESSION;
+ global $CFG;
if ($user->mnethostid != $CFG->mnet_localhost_id) {
return;
$secret = random_string(15);
set_user_preference('login_lockout_secret', $secret, $user);
- // Some nasty hackery to get strings and dates localised for target user.
- $sessionlang = isset($SESSION->lang) ? $SESSION->lang : null;
- if (get_string_manager()->translation_exists($user->lang, false)) {
- $SESSION->lang = $user->lang;
- moodle_setlocale();
- }
+ $oldforcelang = force_current_language($user->lang);
$site = get_site();
$supportuser = core_user::get_support_user();
email_to_user($user, $supportuser, $subject, $message);
}
- if ($SESSION->lang !== $sessionlang) {
- $SESSION->lang = $sessionlang;
- moodle_setlocale();
- }
+ force_current_language($oldforcelang);
}
}
* The arguments of the closure are mixed, use $args depending on your needs.
*
* You can provide an exception to give more accurate feedback to tests writers, otherwise the
- * closure exception will be used, but you must provide an exception if the closure does not throws
+ * closure exception will be used, but you must provide an exception if the closure does not throw
* an exception.
*
* @throws Exception If it timeouts without receiving something != false from the closure
//div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' '))] | //div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]/descendant::h2[normalize-space(.) = %locator%]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]
XPATH
, 'region' => <<<XPATH
-.//*[self::div | self::section | self::aside][./@id = %locator%]
+//*[self::div | self::section | self::aside | self::header | self::footer][./@id = %locator%]
XPATH
, 'table_row' => <<<XPATH
.//tr[contains(normalize-space(.), %locator%)]
/**
* Abstract event for content viewing.
*
+ * This class has been deprecated, please extend base event or other relevent abstract class.
+ *
* @package core
* @copyright 2013 Ankit Agarwal
+ * @deprecated since Moodle 2.7
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
+debugging('core\event\content_viewed has been deprecated. Please extend base event or other relevant abstract class.',
+ DEBUG_DEVELOPER);
+
/**
* Class content_viewed.
*
- * Base class for a content view event. Each plugin must extend this to create their own content view event.
- *
- * An example usage:-
- * $event = \report_participation\event\content_viewed::create(array('courseid' => $course->id,
- * 'other' => array('content' => 'participants'));
- * $event->set_page_detail();
- * $event->set_legacy_logdata(array($course->id, "course", "report participation",
- * "report/participation/index.php?id=$course->id", $course->id));
- * $event->trigger();
- * where \report_participation\event\content_viewed extends \core\event\content_viewed
- *
- * @property-read array $other {
- * Extra information about event.
- *
- * @type string content viewed content identifier.
- * }
+ * This class has been deprecated, please extend base event or other relevent abstract class.
*
* @package core
* @copyright 2013 Ankit Agarwal
+ * @deprecated since Moodle 2.7
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class content_viewed extends base {
--- /dev/null
+<?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/>.
+
+/**
+ * Message contact added event class.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_contact_added extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['objecttable'] = 'message_contacts';
+ $this->data['crud'] = 'c';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessagecontactadded', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->userid . '\' added the user with the id \'' .
+ $this->relateduserid . '\' to their contact list.';
+ }
+
+ /**
+ * Return legacy data for add_to_log().
+ *
+ * @return array
+ */
+ protected function get_legacy_logdata() {
+ return array(SITEID, 'message', 'add contact', 'index.php?user1=' . $this->relateduserid .
+ '&user2=' . $this->userid, $this->relateduserid);
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+ }
+}
--- /dev/null
+<?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/>.
+
+/**
+ * Message contact blocked event class.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_contact_blocked extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['objecttable'] = 'message_contacts';
+ $this->data['crud'] = 'u';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessagecontactblocked', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->userid . '\' blocked the user with the id \'' .
+ $this->relateduserid . '\' on their contact list.';
+ }
+
+ /**
+ * Return legacy data for add_to_log().
+ *
+ * @return array
+ */
+ protected function get_legacy_logdata() {
+ return array(SITEID, 'message', 'block contact', 'index.php?user1=' . $this->relateduserid . '&user2=' .
+ $this->userid, $this->relateduserid);
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+ }
+}
--- /dev/null
+<?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/>.
+
+/**
+ * Message contact removed event class.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_contact_removed extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['objecttable'] = 'message_contacts';
+ $this->data['crud'] = 'd';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessagecontactremoved', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->userid . '\' removed the user with the id \'' .
+ $this->relateduserid . '\' from their contact list.';
+ }
+
+ /**
+ * Return legacy data for add_to_log().
+ *
+ * @return array
+ */
+ protected function get_legacy_logdata() {
+ return array(SITEID, 'message', 'remove contact', 'index.php?user1=' . $this->relateduserid . '&user2=' .
+ $this->userid, $this->relateduserid);
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+ }
+}
--- /dev/null
+<?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/>.
+
+/**
+ * Message contact unblocked event class.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_contact_unblocked extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['objecttable'] = 'message_contacts';
+ $this->data['crud'] = 'u';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessagecontactunblocked', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->userid . '\' unblocked the user with the id \'' .
+ $this->relateduserid . '\' on their contact list.';
+ }
+
+ /**
+ * Return legacy data for add_to_log().
+ *
+ * @return array
+ */
+ protected function get_legacy_logdata() {
+ return array(SITEID, 'message', 'unblock contact', 'index.php?user1=' . $this->relateduserid .
+ '&user2=' . $this->userid, $this->relateduserid);
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+ }
+}
--- /dev/null
+<?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/>.
+
+/**
+ * Message read event class.
+ *
+ * @property-read array $other {
+ * Extra information about event.
+ *
+ * - int messageid: the id of the message.
+ * }
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_read extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['objecttable'] = 'message_read';
+ $this->data['crud'] = 'c';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessageread', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->relateduserid . '\' read a message from the user with the id \'' .
+ $this->userid . '\'.';
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ * @return void
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+
+ if (!isset($this->other['messageid'])) {
+ throw new \coding_exception('The \'messageid\' needs to be set in $other.');
+ }
+ }
+}
--- /dev/null
+<?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/>.
+
+/**
+ * Message sent event class.
+ *
+ * @property-read array $other {
+ * Extra information about event.
+ *
+ * - int messageid: the id of the message.
+ * }
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class message_sent extends base {
+
+ /**
+ * Init method.
+ */
+ protected function init() {
+ $this->data['crud'] = 'c';
+ $this->data['edulevel'] = self::LEVEL_OTHER;
+ }
+
+ /**
+ * Returns localised general event name.
+ *
+ * @return string
+ */
+ public static function get_name() {
+ return get_string('eventmessagesent', 'message');
+ }
+
+ /**
+ * Returns relevant URL.
+ *
+ * @return \moodle_url
+ */
+ public function get_url() {
+ return new \moodle_url('message/index.php', array('user1' => $this->relateduserid, 'user2' => $this->userid));
+ }
+
+ /**
+ * Returns description of what happened.
+ *
+ * @return string
+ */
+ public function get_description() {
+ return 'The user with the id \'' . $this->userid . '\' sent a message to the user with the id \'' .
+ $this->relateduserid . '\'.';
+ }
+
+ /**
+ * Return legacy data for add_to_log().
+ *
+ * @return array
+ */
+ protected function get_legacy_logdata() {
+ return array(SITEID, 'message', 'write', 'index.php?user=' . $this->userid . '&id=' . $this->relateduserid .
+ '&history=1#m' . $this->other['messageid'], $this->userid);
+ }
+
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ * @return void
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ if (!isset($this->relateduserid)) {
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+
+ if (!isset($this->other['messageid'])) {
+ throw new \coding_exception('The \'messageid\' needs to be set in $other.');
+ }
+ }
+}
* @return \moodle_url
*/
public function get_url() {
- $logurl = new \moodle_url('/note/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
+ $logurl = new \moodle_url('/notes/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
$logurl->set_anchor('note-' . $this->objectid);
return $logurl;
}
* @return \moodle_url
*/
public function get_url() {
- $logurl = new \moodle_url('/note/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
+ $logurl = new \moodle_url('/notes/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
$logurl->set_anchor('note-' . $this->objectid);
return $logurl;
}
*
* Class for event to be triggered when a note is viewed.
*
- * @property-read array $other {
- * Extra information about event.
- *
- * @type string content hard-coded to notes.
- * }
- *
* @package core
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class notes_viewed extends \core\event\content_viewed {
+class notes_viewed extends \core\event\base {
/**
* Set basic properties for the event.
* @return string
*/
public function get_description() {
- return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
+ if (!empty($this->relateduserid)) {
+ return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
+ } else {
+ return 'Note for course with id "'. $this->courseid . '" was viewed by user with id "'. $this->userid . '"';
+ }
}
/**
* @return \moodle_url
*/
public function get_url() {
- return new \moodle_url('/note/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
+ return new \moodle_url('/notes/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
}
/**
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
)
+ ),
+
+ 'moodle/site:forcelanguage' => array(
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'archetypes' => array(
+ )
)
);
'core_notes_create_notes',
'core_user_get_course_user_profiles',
'core_enrol_get_enrolled_users',
- 'core_message_send_instant_messages'),
+ 'core_message_send_instant_messages',
+ 'mod_assign_get_grades',
+ 'mod_assign_get_assignments',
+ 'mod_assign_get_submissions',
+ 'mod_assign_get_user_flags',
+ 'mod_assign_set_user_flags',
+ 'mod_assign_get_user_mappings',
+ 'mod_assign_revert_submissions_to_draft',
+ 'mod_assign_lock_submissions',
+ 'mod_assign_unlock_submissions',
+ 'mod_assign_save_submission',
+ 'mod_assign_submit_for_grading',
+ 'mod_assign_save_grade',
+ 'mod_assign_save_user_extensions',
+ 'mod_assign_reveal_identities'),
'enabled' => 0,
'restrictedusers' => 0,
'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
I need to add and remove items from the toolbar
Background:
- Given the following "courses" exists:
+ Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I follow "Course 1"
And I turn editing mode on
And I add a "Database" to section "1"
- Then "#id_introeditor_tbl .mce_bold" "css_element" should not exists
- And "#id_introeditor_tbl .mce_fullscreen" "css_element" should exists
+ Then "#id_introeditor_tbl .mce_bold" "css_element" should not exist
+ And "#id_introeditor_tbl .mce_fullscreen" "css_element" should exist
And I press "Cancel"
@javascript
And I follow "Course 1"
And I turn editing mode on
And I add a "Database" to section "1"
- Then "#id_introeditor_tbl .mce_bold" "css_element" should not exists
- And "#id_introeditor_tbl .mce_anchor" "css_element" should exists
+ Then "#id_introeditor_tbl .mce_bold" "css_element" should not exist
+ And "#id_introeditor_tbl .mce_anchor" "css_element" should exist
And I set the following administration settings values:
| Editor toolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen |
And I am on homepage
And I follow "Course 1"
And I add a "Database" to section "1"
- And "#id_introeditor_tbl .mce_anchor" "css_element" should not exists
+ And "#id_introeditor_tbl .mce_anchor" "css_element" should not exist
And I press "Cancel"
@javascript
And I turn editing mode on
When I add a "Database" to section "1"
And I wait until "#id_introeditor_tbl" "css_element" exists
- Then "#id_introeditor_tbl .mce_bold" "css_element" should exists
- And "#id_introeditor_tbl .mce_anchor" "css_element" should not exists
+ Then "#id_introeditor_tbl .mce_bold" "css_element" should exist
+ And "#id_introeditor_tbl .mce_anchor" "css_element" should not exist
And I press "Cancel"
* @param progress_trace $trace
*/
protected function notify_expiry_enrolled($user, $ue, progress_trace $trace) {
- global $CFG, $SESSION;
+ global $CFG;
$name = $this->get_name();
- // Some nasty hackery to get strings and dates localised for target user.
- $sessionlang = isset($SESSION->lang) ? $SESSION->lang : null;
- if (get_string_manager()->translation_exists($user->lang, false)) {
- $SESSION->lang = $user->lang;
- moodle_setlocale();
- }
+ $oldforcelang = force_current_language($user->lang);
$enroller = $this->get_enroller($ue->enrolid);
$context = context_course::instance($ue->courseid);
$trace->output("error notifying user $ue->userid that enrolment in course $ue->courseid expires on ".userdate($ue->timeend, '', $CFG->timezone), 1);
}
- if ($SESSION->lang !== $sessionlang) {
- $SESSION->lang = $sessionlang;
- moodle_setlocale();
- }
+ force_current_language($oldforcelang);
}
/**