diff --git a/mod/quiz/renderer.php b/mod/quiz/renderer.php index 0d4f46aa812..f323ef0eddb 100644 --- a/mod/quiz/renderer.php +++ b/mod/quiz/renderer.php @@ -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 + ); } /** diff --git a/mod/quiz/tests/behat/preview.feature b/mod/quiz/tests/behat/preview.feature index 39c23ef756a..4616e22c2b3 100644 --- a/mod/quiz/tests/behat/preview.feature +++ b/mod/quiz/tests/behat/preview.feature @@ -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"