You are here

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

Test token values with a text file.

File

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

Class

FileFieldPathsTokensTestCase
Class FileFieldPathsTokensTestCase

Code

public function testTokensBasic() {

  // Prepare a test text file.
  $text_file = $this
    ->getTestFile('text');
  file_save($text_file);

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