3 namespace Drupal\Tests\token\Kernel;
10 class FileTest extends KernelTestBase {
17 public static $modules = array('file');
22 public function setUp() {
24 $this->installEntitySchema('file');
27 function testFileTokens() {
28 // Create a test file object.
29 $file = entity_create('file', array(
31 'filename' => 'test.png',
33 'uri' => 'public://images/test.png',
34 'filemime' => 'image/png',
38 'basename' => 'test.png',
42 $this->assertTokens('file', array('file' => $file), $tokens);
44 // Test a file with no extension and a fake name.
45 $file->filename = 'Test PNG image';
46 $file->uri = 'public://images/test';
53 $this->assertTokens('file', array('file' => $file), $tokens);