MDL-74302 mod_quiz: use notification renderable to display quiz notices
This commit is contained in:
@@ -489,8 +489,11 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
if (!$messages) {
|
||||
return '';
|
||||
}
|
||||
return $this->box($this->heading(get_string('accessnoticesheader', 'quiz'), 3) .
|
||||
$this->access_messages($messages), 'quizaccessnotices');
|
||||
return $this->notification(
|
||||
html_writer::tag('p', get_string('accessnoticesheader', 'quiz')) . $this->access_messages($messages),
|
||||
'warning',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,6 +60,18 @@ Feature: Preview a quiz as a teacher
|
||||
Then I should see "Question 1"
|
||||
And "Start a new preview" "button" should exist
|
||||
|
||||
Scenario: Teachers should see a notice if the quiz is not available to students
|
||||
Given the following "activities" exist:
|
||||
| activity | name | course | timeclose |
|
||||
| quiz | Quiz 2 | C1 | ##yesterday## |
|
||||
And quiz "Quiz 2" contains the following questions:
|
||||
| question | page | maxmark |
|
||||
| TF1 | 1 | |
|
||||
| TF2 | 1 | 3.0 |
|
||||
When I am on the "Quiz 2" "mod_quiz > View" page logged in as "admin"
|
||||
And I press "Preview quiz"
|
||||
Then I should see "if this were a real attempt, you would be blocked" in the ".alert-warning" "css_element"
|
||||
|
||||
Scenario: Admins should be able to preview a quiz
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "admin"
|
||||
When I press "Preview quiz"
|
||||
|
||||
Reference in New Issue
Block a user