mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-54116-master' of git://github.com/cameron1729/moodle
This commit is contained in:
commit
13d04ab6c1
29
blocks/comments/tests/behat/block_comment_dashboard.feature
Normal file
29
blocks/comments/tests/behat/block_comment_dashboard.feature
Normal file
@ -0,0 +1,29 @@
|
||||
@block @block_comments
|
||||
Feature: Enable Block comments on the dashboard and view comments
|
||||
In order to enable the comments block on a the dashboard
|
||||
As a teacher
|
||||
I can add the comments block to my dashboard
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | Frist | teacher1@example.com |
|
||||
|
||||
Scenario: Add the comments block on the dashboard and add comments with Javascript disabled
|
||||
When I log in as "teacher1"
|
||||
And I press "Customise this page"
|
||||
And I add the "Comments" block
|
||||
And I follow "Show comments"
|
||||
And I add "I'm a comment from the teacher" comment to comments block
|
||||
Then I should see "I'm a comment from the teacher"
|
||||
|
||||
@javascript
|
||||
Scenario: Add the comments block on the dashboard and add comments with Javascript enabled
|
||||
When I log in as "teacher1"
|
||||
And I press "Customise this page"
|
||||
And I add the "Comments" block
|
||||
And I add "I'm a comment from the teacher" comment to comments block
|
||||
Then I should see "I'm a comment from the teacher"
|
@ -34,6 +34,11 @@ list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
require_login($course, true, $cm);
|
||||
require_sesskey();
|
||||
|
||||
if (!$course) {
|
||||
// Require_login() does not set context if called without a $course, do it manually.
|
||||
$PAGE->set_context($context);
|
||||
}
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$area = optional_param('area', '', PARAM_AREA);
|
||||
$content = optional_param('content', '', PARAM_RAW);
|
||||
@ -48,7 +53,9 @@ if ($action !== 'add') {
|
||||
|
||||
$cmt = new stdClass;
|
||||
$cmt->contextid = $contextid;
|
||||
$cmt->courseid = $course->id;
|
||||
if ($course) {
|
||||
$cmt->courseid = $course->id;
|
||||
}
|
||||
$cmt->cm = $cm;
|
||||
$cmt->area = $area;
|
||||
$cmt->itemid = $itemid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user