Skip to content

Commit

Permalink
Merge branch 'MOODLE_25_STABLE' into install_25_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
AMOS bot committed Jul 27, 2013
2 parents c0aa2a2 + f171a8c commit 0147686
Show file tree
Hide file tree
Showing 98 changed files with 825 additions and 380 deletions.
2 changes: 2 additions & 0 deletions admin/environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,8 @@
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="optional">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
Expand Down
10 changes: 7 additions & 3 deletions admin/tests/behat/behat_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function i_set_the_following_administration_settings_values(TableNode $ta
}

// Search by label.
$searchbox = $this->find_field('Search in settings');
$searchbox = $this->find_field(get_string('searchinsettings', 'admin'));
$searchbox->setValue($label);
$submitsearch = $this->find('css', 'form.adminsearchform input[type=submit]');
$submitsearch->press();
Expand All @@ -72,8 +72,12 @@ public function i_set_the_following_administration_settings_values(TableNode $ta
// Admin settings does not use the same DOM structure than other moodle forms
// but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
$exception = new ElementNotFoundException($this->getSession(), '"' . $label . '" administration setting ');

// The argument should be converted to an xpath literal.
$label = $this->getSession()->getSelectorsHandler()->xpathLiteral($label);

$fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" .
"[@id=//label[contains(normalize-space(string(.)), '" . $label . "')]/@for]";
"[@id=//label[contains(normalize-space(.), $label)]/@for]";
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" .
"/child::div[contains(concat(' ', @class, ' '), ' form-')]/child::*/parent::div");
Expand All @@ -90,7 +94,7 @@ public function i_set_the_following_administration_settings_values(TableNode $ta
$field = behat_field_manager::get_field_instance($type, $fieldnode, $this->getSession());
$field->set_value($value);

$this->find_button('Save changes')->press();
$this->find_button(get_string('savechanges'))->press();
}
}

Expand Down
2 changes: 1 addition & 1 deletion admin/tests/behat/display_short_names.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Display extended course names
And I should not see "C_shortname Course fullname"

Scenario: Courses list with extended course names
Given I click on "Courses" "link" in the "//div[@id='settingsnav']//descendant::li[contains(concat(' ', @class, ' '), ' type_setting ')][not(contains(., 'Site administration'))][contains(., 'Appearance')]" "xpath_element"
Given I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][not(contains(., 'Site administration'))][contains(., 'Appearance')]" "xpath_element"
And I check "Display extended course names"
When I press "Save changes"
And I am on homepage
Expand Down
3 changes: 3 additions & 0 deletions admin/tool/behat/cli/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
$CFG->{$var} = $CFG->{'behat_' . $var};
}

// Clean $CFG extra values before performing any action.
behat_clean_init_config();

$CFG->noemailever = true;
$CFG->passwordsaltmain = 'moodle';

Expand Down
3 changes: 1 addition & 2 deletions admin/tool/behat/lang/en/tool_behat.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@
$string['viewsteps'] = 'Filter';
$string['wheninfo'] = 'When. Actions that provokes an event';
$string['wrongbehatsetup'] = 'Something is wrong with behat setup, ensure:<ul>
<li>You ran "curl http://getcomposer.org/installer | php"</li>
<li>You ran "php composer.phar install --dev"</li>
<li>You ran "php admin/tool/behat/cli/init.php" from your moodle root directory</li>
<li>vendor/bin/behat file has execution permissions</li></ul>';
4 changes: 2 additions & 2 deletions admin/tool/behat/tests/behat/basic_actions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ Feature: Page contents assertions
And I follow "Course 1"
When I click on "Move this to the dock" "button" in the ".block_settings" "css_element"
Then I should not see "Question bank"
And I click on "//div[@id='dock']/descendant::*[contains(., 'Administration')]/h2" "xpath_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:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
When I click on "Move this to the dock" "button" in the "//*[contains(concat(' ', normalize-space(@class), ' '), ' block_settings ')]" "xpath_element"
When I click on "Move this to the dock" "button" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' block_settings ')]" "xpath_element"
Then I should not see "Turn editing on"
16 changes: 8 additions & 8 deletions admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ Feature: Set up contextual data for tests
Then I should see "Course 1"
And I should see "Course 2"
And I should see "Course 3"
When I go to the courses management page
And I go to the courses management page
And I follow "Cat 1"
Then I should see "Cat 2"
And I should see "Cat 2"
And I should see "Cat 3"
When I follow "Cat 3"
Then I should see "Course 1"
And I follow "Cat 3"
And I should see "Course 1"
And I should see "Course 2"
When I select "Cat 2" from "Course categories:"
Then I should see "No courses in this category"
When I select "Miscellaneous" from "Course categories:"
Then I should see "Course 3"
And I select "Cat 1 / Cat 2" from "Course categories:"
And I should see "No courses in this category"
And I select "Miscellaneous" from "Course categories:"
And I should see "Course 3"

@javascript
Scenario: Add a bunch of groups and groupings
Expand Down
10 changes: 4 additions & 6 deletions admin/tool/profiling/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@
$prevreferences = $DB->get_records_select('profiling',
'url = ? AND runreference = 1 AND timecreated < ?',
array($run->url, $run->timecreated),
'timecreated DESC', 'runid', 0, 1);
$prevrunid = $prevreferences ? reset($prevreferences)->runid : false;
'timecreated DESC', 'runid, runcomment, timecreated', 0, 10);
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
$header = get_string('lastrunof', 'tool_profiling', $script);
echo $OUTPUT->heading($header);
$table = profiling_print_run($run, $prevrunid);
$table = profiling_print_run($run, $prevreferences);
echo $table;
echo $OUTPUT->box_end();

Expand Down Expand Up @@ -126,12 +125,11 @@
$prevreferences = $DB->get_records_select('profiling',
'url = ? AND runreference = 1 AND timecreated < ?',
array($run->url, $run->timecreated),
'timecreated DESC', 'runid', 0, 1);
$prevrunid = $prevreferences ? reset($prevreferences)->runid : false;
'timecreated DESC', 'runid, runcomment, timecreated', 0, 10);
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
$header = get_string('summaryof', 'tool_profiling', $run->url);
echo $OUTPUT->heading($header);
$table = profiling_print_run($run, $prevrunid);
$table = profiling_print_run($run, $prevreferences);
echo $table;
echo $OUTPUT->box_end();

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/profiling/lang/en/tool_profiling.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
$string['runid'] = 'Run ID';
$string['summaryof'] = 'Summary of {$a}';
$string['viewdetails'] = 'View profiling details';
$string['viewdiff'] = 'View profiling differences with last reference run';
$string['viewdiff'] = 'View profiling differences with:';
$string['viewdiffdetails'] = 'View profiling diff details';
10 changes: 5 additions & 5 deletions auth/tests/behat/behat_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class behat_auth extends behat_base {
public function i_log_in_as($username) {

return array(new Given('I am on homepage'),
new Given('I follow "Login"'),
new Given('I fill in "Username" with "'.$username.'"'),
new Given('I fill in "Password" with "'.$username.'"'),
new Given('I press "Login"')
new Given('I follow "' . get_string('login') . '"'),
new Given('I fill in "' . get_string('username') . '" with "' . $this->escape($username) . '"'),
new Given('I fill in "' . get_string('password') . '" with "'. $this->escape($username) . '"'),
new Given('I press "' . get_string('login') . '"')
);
}

Expand All @@ -62,7 +62,7 @@ public function i_log_in_as($username) {
* @Given /^I log out$/
*/
public function i_log_out() {
return new When('I follow "Logout"');
return new When('I follow "' . get_string('logout') . '"');
}

}
23 changes: 19 additions & 4 deletions backup/backupfilesedit_form.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand All @@ -24,16 +23,32 @@
require_once($CFG->libdir.'/formslib.php');

class backup_files_edit_form extends moodleform {
function definition() {

/**
* Form definition.
*/
public function definition() {
$mform =& $this->_form;
$contextid = $this->_customdata['contextid'];
$options = array('subdirs'=>0, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL | FILE_REFERENCE);

$options = array('subdirs' => 0, 'maxfiles' => -1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL | FILE_REFERENCE);

$mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);

$mform->addElement('hidden', 'contextid', $this->_customdata['contextid']);
$mform->setType('contextid', PARAM_INT);

$mform->addElement('hidden', 'currentcontext', $this->_customdata['currentcontext']);
$mform->setType('currentcontext', PARAM_INT);

$mform->addElement('hidden', 'filearea', $this->_customdata['filearea']);
$mform->setType('filearea', PARAM_AREA);

$mform->addElement('hidden', 'component', $this->_customdata['component']);
$mform->setType('component', PARAM_COMPONENT);

$mform->addElement('hidden', 'returnurl', $this->_customdata['returnurl']);
$mform->setType('returnurl', PARAM_URL);

$this->add_action_buttons(true, get_string('savechanges'));
$this->set_data($this->_customdata['data']);
}
Expand Down
19 changes: 13 additions & 6 deletions backup/util/dbops/restore_dbops.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,20 @@ public static function prechek_precheck_qbanks_by_level($restoreid, $courseid, $
} else {
self::set_backup_ids_record($restoreid, 'question_category', $category->id, $matchcat->id, $targetcontext->id);
$questions = self::restore_get_questions($restoreid, $category->id);

// Collect all the questions for this category into memory so we only talk to the DB once.
$questioncache = $DB->get_records_sql_menu("SELECT ".$DB->sql_concat('stamp', "' '", 'version').", id
FROM {question}
WHERE category = ?", array($matchcat->id));

foreach ($questions as $question) {
$matchq = $DB->get_record('question', array(
'category' => $matchcat->id,
'stamp' => $question->stamp,
'version' => $question->version));
if (isset($questioncache[$question->stamp." ".$question->version])) {
$matchqid = $questioncache[$question->stamp." ".$question->version];
} else {
$matchqid = false;
}
// 5a) No match, check if user can add q
if (!$matchq) {
if (!$matchqid) {
// 6a) User can, mark the q to be created
if ($canadd) {
// Nothing to mark, newitemid means create
Expand All @@ -645,7 +652,7 @@ public static function prechek_precheck_qbanks_by_level($restoreid, $courseid, $

// 5b) Match, mark q to be mapped
} else {
self::set_backup_ids_record($restoreid, 'question', $question->id, $matchq->id);
self::set_backup_ids_record($restoreid, 'question', $question->id, $matchqid);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions backup/util/ui/tests/behat/backup_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Backup Moodle courses
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 I click on "//div[contains(concat(' ', @class, ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element"
And I click on "setting_root_logs" "checkbox" in the "//div[contains(@class, 'fitem')][contains(., 'Include course logs')]" "xpath_element"
And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exists
And I check "Include course logs"
And I press "Cancel"
And I click on "Cancel" "button" in the ".confirmation-dialogue" "css_element"
Loading

0 comments on commit 0147686

Please sign in to comment.