You are here

public function FileFieldPathsGeneralTestCase::testNoFile in File (Field) Paths 7

Test File (Field) Paths works as normal when no file uploaded.

File

tests/filefield_paths.general.test, line 48
Tests for the File (Field) Paths module.

Class

FileFieldPathsGeneralTestCase
Class FileFieldPathsGeneralTestCase

Code

public function testNoFile() {

  // Create a File field.
  $field_name = drupal_strtolower($this
    ->randomName());
  $instance_settings['filefield_paths']['file_path']['value'] = 'node/[node:nid]';
  $instance_settings['filefield_paths']['file_name']['value'] = '[node:nid].[file:ffp-extension-original]';
  $this
    ->createFileField($field_name, $this->content_type, array(), $instance_settings);

  // Create a node without a file attached.
  $this
    ->drupalCreateNode(array(
    'type' => $this->content_type,
  ));
}