Skip to content

Commit 3923269

Browse files
Tai Le Tansammarshallou
Tai Le Tan
authored andcommitted
Behat: mod/oublog (tt, OUVLE_458) - Child blog only show data relating to master blog + 16 more... #679629
1 parent c6bccb3 commit 3923269

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

locallib.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4566,7 +4566,8 @@ function oublog_stats_output_myparticipation($oublog, $cm, $renderer, $course, $
45664566
if (!$participation->posts) {
45674567
$content .= html_writer::tag('p', get_string('nouserposts', 'oublog'));
45684568
} else {
4569-
$percent = $stat = null;
4569+
$percent = 0;
4570+
$stat = null;
45704571
$content .= html_writer::tag('h3', get_string('numberposts', 'oublog', $participation->numposts));
45714572
foreach ($participation->posts as $post) {
45724573
if ($postedcount >= ($postshow - $commenttotal)) {
@@ -4593,7 +4594,8 @@ function oublog_stats_output_myparticipation($oublog, $cm, $renderer, $course, $
45934594
if (!$participation->comments) {
45944595
$content .= html_writer::tag('p', get_string('nousercomments', 'oublog'));
45954596
} else {
4596-
$percent = $stat = null;// Removing all stats div.
4597+
$percent = 0;
4598+
$stat = null;// Removing all stats div.
45974599
$content .= html_writer::tag('h3', get_string('numbercomments', 'oublog', $participation->numcomments));
45984600
foreach ($participation->comments as $comment) {
45994601
if (($commentedcount + $postedcount) >= $postshow ) {
@@ -4700,7 +4702,8 @@ function oublog_stats_output_participation($oublog, $cm, $renderer, $course, $al
47004702
}
47014703
// For visible individual blogs show post activity also when no individual selected.
47024704
} else {
4703-
$percent = $stat = null;
4705+
$percent = 0;
4706+
$stat = null;
47044707
$content .= html_writer::tag('p', get_string('recentposts', 'oublog'));
47054708
foreach ($participation->posts as $post) {
47064709
// Post user object required for oublog_statsinfo.
@@ -4781,7 +4784,8 @@ function oublog_stats_output_participation($oublog, $cm, $renderer, $course, $al
47814784
if (!$participation->comments && $getcomments) {
47824785
$content .= html_writer::tag('p', get_string('nousercomments', 'oublog'));
47834786
} else {
4784-
$percent = $stat = null;// Removing all stats div.
4787+
$percent = 0;
4788+
$stat = null;// Removing all stats div.
47854789
if ($blogtype || $getcomments) {
47864790
$content .= html_writer::tag('p', get_string('recentcomments', 'oublog'));
47874791
}
@@ -4876,8 +4880,10 @@ function oublog_stats_output_participation($oublog, $cm, $renderer, $course, $al
48764880
// We output just post.
48774881
$label .= html_writer::div(oublog_date($comment->timeposted) , 'oublogstats_commentposts_blogname');
48784882
}
4879-
$statinfo = new oublog_statsinfo($commentuser, $percent, $stat, $url, $label);
4880-
$content .= $renderer->render($statinfo);
4883+
if ($commentuser->id > 0) {
4884+
$statinfo = new oublog_statsinfo($commentuser, $percent, $stat, $url, $label);
4885+
$content .= $renderer->render($statinfo);
4886+
}
48814887
$commentedcount++;
48824888
}
48834889
}

tests/behat/lastupdated.feature

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ Feature: Show last updated information on OU blog activity link
8383
And I log in as "student1"
8484
And I am on "Course 1" course homepage
8585
# Student should see both indicators.
86-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
87-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
86+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
87+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
8888
Given I log out
8989
And I log in as "student2"
9090
And I am on "Course 1" course homepage
9191
# Student should see only visible group indicators.
92-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
93-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
92+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
93+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
9494

9595
Scenario: Indivdual blogs
9696
Given I log in as "admin"
@@ -125,8 +125,8 @@ Feature: Show last updated information on OU blog activity link
125125
And I log in as "student1"
126126
And I am on "Course 1" course homepage
127127
# Student should see visible indicator only.
128-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
129-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
128+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
129+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
130130

131131
Scenario: Mixed blogs
132132
Given I log in as "admin"
@@ -189,31 +189,31 @@ Feature: Show last updated information on OU blog activity link
189189
| Message | P1 |
190190
And I press "Add post"
191191
When I am on "Course 1" course homepage
192-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
193-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
194-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
195-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
192+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
193+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
194+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
195+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
196196
And I log out
197197
Given I log in as "student1"
198198
And I am on "Course 1" course homepage
199199
# Student should see visible indicator only.
200-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
201-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
202-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
203-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
200+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
201+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
202+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
203+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
204204
Given I follow "B.VISG"
205205
And I press "New blog post"
206206
And I set the following fields to these values:
207207
| Title | P3 |
208208
| Message | P3 |
209209
And I press "Add post"
210210
When I am on "Course 1" course homepage
211-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
211+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
212212
And I log out
213213
Given I log in as "student2"
214214
And I am on "Course 1" course homepage
215215
# Student should see visible group+individuals only.
216-
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
217-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
218-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
219-
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist
216+
Then "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][1]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
217+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][2]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
218+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][3]//span[@class='lastmodtext oubloglmt']" "xpath_element" should not exist
219+
And "/descendant::li[@class='activity activity-wrapper oublog modtype_oublog '][4]//span[@class='lastmodtext oubloglmt']" "xpath_element" should exist

0 commit comments

Comments
 (0)