You are here

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

Test token value with a UTF file.

See also

https://www.drupal.org/node/1292436

File

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

Class

FileFieldPathsTokensTestCase
Class FileFieldPathsTokensTestCase

Code

public function testTokensUTF() {

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

  // Ensure tokens are processed correctly.
  $data = array(
    'file' => $utf_file,
  );
  $this
    ->assertToken('[file:ffp-name-only]', 'тест', $data);
}