private function CommentGoodnessCommentDateTestCase::testCommentDateFormat in Comment goodness 7
Change comment created date to short, changed to long and confirm the that the change is effective.
@todo Incomplete, finish implementation: check in the rendered node if the dates are formatted correctly. The testability depends on a patch. Once that is finished, make the function public again, so that it can run.
File
- tests/
comment_goodness.test, line 153
Class
- CommentGoodnessCommentDateTestCase
- Test if comment date (created/changed) format is configurable.
Code
private function testCommentDateFormat() {
$langcode = LANGUAGE_NONE;
$title_key = "title";
$body_key = "body[{$langcode}][0][value]";
$edit = array();
$edit[$title_key] = $this
->randomName(8);
$edit[$body_key] = $this
->randomName(16);
$this
->drupalPost('node/add/article', $edit, t('Save'));
$node = $this
->drupalGetNodeByTitle($edit[$title_key]);
$comment_text = $this
->randomName();
$comment = $this
->postComment($node, $comment_text);
// Change comment date format for articles.
$edit = array(
'comment_created_date_format' => 'short',
'comment_changed_date_format' => 'long',
);
$this
->drupalPost('/admin/structure/types/manage/article', $edit, t('Save content type'));
$this
->drupalGet("node/{$node->nid}");
$xpath = '//title';
$this
->assertEqual(current($this
->xpath($xpath)), $node->title . ' | Drupal', 'Page title is equal to node title.', 'Node');
$this
->drupalLogout();
}