You are here

public function FileFieldPathsTokensTestCase::testTokensMultiExtension in File (Field) Paths 7

Test token values with a multi-extension text file.

File

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

Class

FileFieldPathsTokensTestCase
Class FileFieldPathsTokensTestCase

Code

public function testTokensMultiExtension() {

  // Prepare a test text file.
  $text_file = $this
    ->getTestFile('text');
  file_unmanaged_copy($text_file->uri, 'public://text.multiext.txt');
  $files = file_scan_directory('public://', '/text\\.multiext\\.txt/');
  $multiext_file = current($files);
  file_save($multiext_file);

  // Ensure tokens are processed correctly.
  $data = array(
    'file' => $multiext_file,
  );
  $this
    ->assertToken('[file:ffp-name-only]', 'text.multiext', $data);
  $this
    ->assertToken('[file:ffp-name-only-original]', 'text.multiext', $data);
  $this
    ->assertToken('[file:ffp-extension-original]', 'txt', $data);
}