You are here

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

Test token values with a moved text file.

File

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

Class

FileFieldPathsTokensTestCase
Class FileFieldPathsTokensTestCase

Code

public function testTokensMoved() {

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

  // Move the text file.
  $moved_file = file_move($text_file, 'public://moved.diff');

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