You are here

function FileEntityTokenTestCase::testFileEntityTokens in File Entity (fieldable files) 7

Same name and namespace in other branches
  1. 7.3 file_entity.test \FileEntityTokenTestCase::testFileEntityTokens()
  2. 7.2 file_entity.test \FileEntityTokenTestCase::testFileEntityTokens()

File

tests/file_entity.test, line 44
Test integration for the file_entity module.

Class

FileEntityTokenTestCase

Code

function testFileEntityTokens() {
  $text_files = $this
    ->drupalGetTestFiles('text');
  foreach ($text_files as &$file) {
    $files = file_save($file);
  }
  $tokens = array(
    'type' => 'Text',
    'type:name' => 'Text',
    'type:machine-name' => 'text',
    'type:count' => count($text_files),
  );
  $this
    ->assertTokens('file', array(
    'file' => $text_files[0],
  ), $tokens);
  $image_files = $this
    ->drupalGetTestFiles('image');
  foreach ($image_files as &$file) {
    $files = file_save($file);
  }
  $tokens = array(
    'type' => 'Image',
    'type:name' => 'Image',
    'type:machine-name' => 'image',
    'type:count' => count($image_files),
  );
  $this
    ->assertTokens('file', array(
    'file' => $image_files[0],
  ), $tokens);
}