comment.test includes a one line reference to comment controls, that'll need to be taken out if #175841 gets committed.

I need to get up to speed on SimpleTest so might as well start by trying not to break existing tests. No patch yet but this will remind me to do it.

Not sure what the deal is with statuses, so marking postponed because this won't get committed until the core issue does.

CommentFileSizeAuthor
#12 comment.test.patch8.24 KBaaronbauman
#3 controls-test.patch1009 bytescatch

Comments

boombatower’s picture

Thanks for making this issue.

catch’s picture

Category: task » bug
Priority: Minor » Normal
Status: Postponed » Active

OK so that patch has got in, but it looks like setCommentForm is mixing up two different settings anyway.

  /**
   * Set comment form setting.
   *
   * @param boolean $enabled Form value.
   */
  function setCommentForm($enabled) {
    $this->setCommentSettings('comment_form_location', ($enabled ? '1' : '3'), 'Comment controls '. ($enabled ? 'enabled' : 'disabled') .'.');
  }

The position of the comment form (on the same page as the node/comments or on a separate page) is a completely different issue to whether comment controls were enabled or disabled and their position (above, below or both).

Should probably be something like this (completely untested).

  /**
   * Set comment form setting.
   *
   * @param boolean $below Form value.
   */
  function setCommentForm($below) {
    $this->setCommentSettings('comment_form_location', ($below ? '1' : '0'), 'Comment form ' . ($below ? 'below' : 'separate page')  . '.');
  }

Have to say this vindicates how confusing comment controls were though....

catch’s picture

Status: Active » Needs review
StatusFileSize
new1009 bytes

I appreciate the irony of uploading an untested patch to the SimpleTest issue queue and hang my head in shame. Won't have time to try tests etc. until at least this weekend. Hopefully this is trivial enough that I didn't do anything stupid.

boombatower’s picture

I'm curious why this doesn't cause an error when the patch is not applied. Any thoughts?

catch’s picture

Project: SimpleTest » Drupal core
Version: » 7.x-dev
Component: Code » comment.module

Had a quick look although still only time for visual review, comment module uses the COMMENT_FORM_SEPARATE_PAGE constant in nearly all cases except for the very end of comment_render.

Additionally, testFormOnPage only verifies that setCommentForm(TRUE) results in the comment form being rendered on the page (which it should because that bit's right), it doesn't check the converse. This explains why the tests were passing I guess.

Also, moving to core!

catch’s picture

Component: comment.module » tests
Status: Needs review » Needs work

comment settings are per node type, so this is more wrong than I originally thought. Moving to tests component.

catch’s picture

Title: Update comment.test for comment controls » Comment form location isn't tested
Assigned: catch » Unassigned
Status: Needs work » Postponed

Retitling this since although the comment controls are mentioned, that's just a symptom of a wider problem in the test - this section bears no resemblance to what actually happens in core at all.

Also marking postponed pending this general cleanup: http://drupal.org/node/251843

catch’s picture

Title: Comment form location isn't tested » TestingParty08: comment form location
Priority: Normal » Critical
Status: Postponed » Active

The comment form location is now a per-node-type setting. This isn't reflected in the current comment.test - so it needs changing to use the proper variables, and then a check to ensure the form shows up on the correct pages.

aaronbauman’s picture

Component: tests » comment.module
Assigned: Unassigned » aaronbauman
aaronbauman’s picture

Status: Active » Needs review

Please see the patch submitted to #296483: TestingParty08: paged comments. This patch addresses the per-node visibility of the Comment form.

Status: Needs review » Needs work

The last submitted patch failed testing.

aaronbauman’s picture

StatusFileSize
new8.24 KB

OK, System Message, if you insist I will re-post

aaronbauman’s picture

Status: Needs work » Needs review
boombatower’s picture

Status: Needs review » Postponed

Is that the same test from the other issue? If so then just finish in that issue and then we can mark this one as fixed...so for now lets mark this a postponed.

catch’s picture

Category: bug » task
Priority: Critical » Normal
Status: Postponed » Needs work
aaronbauman’s picture

Assigned: aaronbauman » Unassigned
boombatower’s picture

Version: 7.x-dev » 8.x-dev

Should be re-evaluated against 8.x to see if still necessary and if so committed and backported.

aspilicious’s picture

Status: Needs work » Closed (fixed)

Checked these tests, they are alrdy incorporated in drupal core in some way. :)