-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let students view questions after "close time"
- Loading branch information
1 parent
1b1788f
commit d82e763
Showing
11 changed files
with
205 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
// This file is part of the mod_coursecertificate plugin for 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/>. | ||
|
||
/** | ||
* mod_hotquestion steps definitions. | ||
* | ||
* @package mod_hotquestion | ||
* @category test | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php'); | ||
|
||
/** | ||
* Steps definitions for mod_hotquestion. | ||
* | ||
* @package mod_hotquestion | ||
* @category test | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class behat_mod_hotquestion extends behat_base { | ||
|
||
/** | ||
* Step to open current course or activity settings page (language string changed between 3.11 and 4.0) | ||
* | ||
* @When /^I open course or activity settings page$/ | ||
* @return void | ||
*/ | ||
public function i_open_course_or_activity_settings_page(): void { | ||
global $CFG; | ||
if ($CFG->version < 2022012100) { | ||
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", ['Edit settings']); | ||
} else { | ||
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", ['Settings']); | ||
} | ||
} | ||
} |
File renamed without changes.
89 changes: 89 additions & 0 deletions
89
tests/behat/questions_visibility_after_closing_time.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
@mod @mod_hotquestion | ||
Feature: Set entry visibility after close time for HotQuestion | ||
In order to control if a student can HotQuestion entries after closing time | ||
As a teacher | ||
I need to be able to set availability dates and viewaftertimeclose flag for a hotquestion. | ||
|
||
Background: | ||
Given the following "courses" exist: | ||
| fullname | shortname | category | groupmode | | ||
| Course 1 | C1 | 0 | 1 | | ||
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" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And the following "activity" exists: | ||
| activity | hotquestion | | ||
| course | C1 | | ||
| idnumber | hotquestion1 | | ||
| name | Test hotquestion name | | ||
| intro | Test hotquestion description | | ||
| grade | 0 | | ||
| timeopen | 0 | | ||
| timeclose | 0 | | ||
| viewaftertimeclose | 0 | | ||
Scenario: Student doesn't see questions after close time | ||
#Teacher 1 posts an entry | ||
Given I log in as "teacher1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I set the following fields to these values: | ||
| Submit your question here | First question | | ||
And I press "Click to post" | ||
And I should not see "No entries yet." | ||
And I should see "First question" | ||
Then I log out | ||
#Student 1 views and posts the questions | ||
Given I log in as "student1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I should see "First question" | ||
Then I log out | ||
#Teacher 1 set time close | ||
Given I log in as "teacher1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I open course or activity settings page | ||
And I set the following fields to these values: | ||
| timeclose[enabled] | 1 | | ||
| timeclose[day] | 1 | | ||
| timeclose[month] | 2 | | ||
| timeclose[year] | 2017 | | ||
And I press "Save and return to course" | ||
Then I log out | ||
#Student 1 cannot view questions | ||
Given I log in as "student1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I should see "Not currently available!" | ||
Then I log out | ||
Scenario: Student do see questions after close time when "View after close time" is set | ||
#Teacher 1 posts an entry, set close time and enables "View after close time" | ||
Given I log in as "teacher1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I set the following fields to these values: | ||
| Submit your question here | First question | | ||
And I press "Click to post" | ||
And I should not see "No entries yet." | ||
And I should see "First question" | ||
Then I open course or activity settings page | ||
And I set the following fields to these values: | ||
| timeclose[enabled] | 1 | | ||
| timeclose[day] | 1 | | ||
| timeclose[month] | 2 | | ||
| timeclose[year] | 2017 | | ||
| viewaftertimeclose | 1 | | ||
And I press "Save and return to course" | ||
Then I log out | ||
#Student 1 views questions | ||
Given I log in as "student1" | ||
When I am on "Course 1" course homepage | ||
And I follow "Test hotquestion name" | ||
And I should see "First question" | ||
And I should not see "Submit your question here" | ||
Then I log out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters