You are here

public function CommentAlterFileTestCase::testFileFieldSingle in Comment Alter 7

File

./comment_alter.test, line 540
Functional tests for the Comment Alter module.

Class

CommentAlterFileTestCase
Functional tests for Comment Alter and File fields.

Code

public function testFileFieldSingle() {
  $field_name = $this
    ->createField('file', 'file_generic', array(
    'cardinality' => 1,
  ));
  $file = $this
    ->getTestFile('text');
  $this
    ->createNodeThenPostComment(array(), array(
    "files[{$field_name}_" . LANGUAGE_NONE . '_0]' => drupal_realpath($file->uri),
  ));
  $this
    ->assertCommentDiff(array(
    $field_name => array(
      array(
        NULL,
        'File: ' . basename($file->uri),
      ),
    ),
  ));
}