TestingParty08: comments as replies to other comments

catch - August 17, 2008 - 20:40
Project:Drupal
Version:7.x-dev
Component:tests
Category:bug report
Priority:normal
Assigned:domas
Status:closed
Description

Post a comment as a reply to another comment, check the pid is correct, probably threading too.

#1

domas - August 31, 2008 - 09:29
Assigned to:Anonymous» domas

Working on it..

#2

domas - August 31, 2008 - 10:39
Priority:critical» normal
Status:active» needs review

Submitted the patch providing the required patch. One thing, that, in my opinion, should be done in the future, is to rewrite postComment (ant other comment methods) to return the full comment object (I had to resort to using comment_load). As always, if there's anything wrong with the code, please let me know.

AttachmentSize
comment_pid_test.patch 907 bytes

#3

catch - September 21, 2008 - 16:27

Should we be checking the thread string as well here?

#4

johnskulski - October 12, 2008 - 03:21

Test applies and succeeds.

Manual replying to a comment results in a 'notice: Undefined offset: 1 in /home/jskulski/public_html/drupal7/modules/comment/comment.module on line 734.'

$parent_depth = count(explode('.', $parent->thread));
$last = $parts[$parent_depth];

parent depth is always always going to be one greater than parts. It's possible the SQL query is not grabbing the right row, and that results in the thread post number never getting increased).

(Multiple 05.01's instead of 05.01, 05.02, 05.03...)

#5

johnskulski - October 13, 2008 - 21:32

I wrote a patch to this found at:

http://drupal.org/node/320784

#6

johnskulski - October 14, 2008 - 01:20

Here is a patch that includes a (0) original pid test from domas (1) test for threading and(2) a second comment reply

(0) Because it worked :)

(1) One because it was asked for and we would have found #320784: Comment threads not incrementing with it

(2) Because with the patch i submitted in the above issue, we need to cover more of comment.module code.

The coverage test (http://acquia.com/files/test-results/modules_comment_comment.module.html) will be changing, once the patch gets committed and we will need to test both conditions on the if statement on line 712.
(1) will test the if, and (2) will test the else

I ran into the issue domas noted, there was no available comment object, so it had to be loaded. However postComment also does not have the object, so I think it overkill to load it in postComment and pass it back for every call. Why not just let the test decide if it needs to be loaded? RFC.

here's the patch, I had to change the some surrounding tests to reflect my changes, as well. (Test for 3 comment link instead of 2 comment link)

NOTE: These tests will fail on current HEAD until the above patch is committed

AttachmentSize
comment_pid_thread_test.patch 2.33 KB

#7

Damien Tournoud - October 14, 2008 - 21:22
Status:needs review» fixed

Dries committed #6.

#8

Anonymous (not verified) - October 28, 2008 - 21:31
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.