public function CommentAlterAdminTestCase::testNodeFieldInstanceSettings in Comment Alter 7
File
- ./comment_alter.test, line 298
- Functional tests for the Comment Alter module.
Class
- CommentAlterAdminTestCase
- Functional tests for the admin UIs provided by Comment Alter.
Code
public function testNodeFieldInstanceSettings() {
$field_name = $this
->createField('text', 'text_textfield', array(
'cardinality' => 1,
), array(), FALSE);
$type_name = str_replace('_', '-', $this->content_type);
$manage_field_path = "admin/structure/types/manage/{$type_name}/fields/{$field_name}";
$alterable_fields = comment_alter_get_alterable_fields($this->content_type);
$this
->assertEqual($alterable_fields, array());
$this
->drupalGet($manage_field_path);
$this
->assertFieldByName("instance[comment_alter]");
$edit = array(
'instance[comment_alter]' => TRUE,
);
$this
->drupalPost(NULL, $edit, t('Save settings'));
drupal_static_reset('comment_alter_get_alterable_fields');
$alterable_fields = comment_alter_get_alterable_fields($this->content_type);
$this
->assertEqual($alterable_fields, array(
$field_name,
));
$this
->attachFieldToComment($field_name);
$this
->drupalGet($manage_field_path);
$this
->assertText(t('This field also exists on the comment. You must remove it from the comment in order to enable altering this field from comments.'));
drupal_static_reset('comment_alter_get_alterable_fields');
$alterable_fields = comment_alter_get_alterable_fields($this->content_type);
$this
->assertEqual($alterable_fields, array());
}