MDL-29627 quiz old popup int column => new browsersecurity column.

The new column store more meaningful string constants.
This commit is contained in:
Tim Hunt 2011-10-06 20:15:01 +01:00
parent 0eafc98852
commit 4344c5d5d9
15 changed files with 170 additions and 46 deletions

View file

@ -39,7 +39,7 @@ class quizaccess_safebrowser extends quiz_access_rule_base {
public static function make(quiz $quizobj, $timenow, $canignoretimelimits) {
if ($quizobj->get_quiz()->popup != 2) {
if ($quizobj->get_quiz()->browsersecurity !== 'safebrowser') {
return null;
}
@ -83,6 +83,6 @@ class quizaccess_safebrowser extends quiz_access_rule_base {
return array();
}
return array(2 => get_string('requiresafeexambrowser', 'quiz'));
return array('safebrowser' => get_string('requiresafeexambrowser', 'quiz'));
}
}

View file

@ -41,7 +41,7 @@ class quizaccess_safebrowser_test extends UnitTestCase {
// Nothing very testable in this class, just test that it obeys the general access rule contact.
public function test_safebrowser_access_rule() {
$quiz = new stdClass();
$quiz->popup = 1;
$quiz->browsersecurity = 'safebrowser';
$quiz->questions = '';
$cm = new stdClass();
$cm->id = 0;

View file

@ -54,7 +54,7 @@ class quizaccess_securewindow extends quiz_access_rule_base {
public static function make(quiz $quizobj, $timenow, $canignoretimelimits) {
if ($quizobj->get_quiz()->popup != 1) {
if ($quizobj->get_quiz()->browsersecurity !== 'securewindow') {
return null;
}
@ -89,6 +89,6 @@ class quizaccess_securewindow extends quiz_access_rule_base {
* security settings menu.
*/
public static function get_browser_security_choices() {
return array(1 => get_string('popupwithjavascriptsupport', 'quiz'));
return array('securewindow' => get_string('popupwithjavascriptsupport', 'quiz'));
}
}

View file

@ -41,7 +41,7 @@ class quizaccess_securewindow_test extends UnitTestCase {
// Nothing very testable in this class, just test that it obeys the general access rule contact.
public function test_securewindow_access_rule() {
$quiz = new stdClass();
$quiz->popup = 1;
$quiz->browsersecurity = 'securewindow';
$quiz->questions = '';
$cm = new stdClass();
$cm->id = 0;