Tests comment links.
The output of comment links depends on various environment conditions:
To account for all possible cases, this test creates permutations of all possible conditions and tests the expected appearance of comment links in each environment.
function testCommentLinks() {
// Bartik theme alters comment links, so use a different theme.
theme_enable(array(
'stark',
));
config('system.theme')
->set('default', 'stark')
->save();
// Remove additional user permissions from $this->web_user added by setUp(),
// since this test is limited to anonymous and authenticated roles only.
$roles = $this->web_user->roles;
entity_delete_multiple('user_role', array(
reset($roles),
));
// Matrix of possible environmental conditions and configuration settings.
// See setEnvironment() for details.
$conditions = array(
'authenticated' => array(
FALSE,
TRUE,
),
'comment count' => array(
FALSE,
TRUE,
),
'access comments' => array(
0,
1,
),
'post comments' => array(
0,
1,
),
'form' => array(
COMMENT_FORM_BELOW,
COMMENT_FORM_SEPARATE_PAGE,
),
// USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL is irrelevant for this
// test; there is only a difference between open and closed registration.
'user_register' => array(
USER_REGISTER_VISITORS,
USER_REGISTER_ADMINISTRATORS_ONLY,
),
);
$environments = $this
->generatePermutations($conditions);
foreach ($environments as $info) {
$this
->assertCommentLinks($info);
}
}