Pathauto and dependencies
This commit is contained in:
parent
4b1a293d57
commit
24ffcb956b
257 changed files with 29510 additions and 0 deletions
55
web/modules/contrib/token/tests/src/Kernel/FileTest.php
Normal file
55
web/modules/contrib/token/tests/src/Kernel/FileTest.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\token\Kernel;
|
||||
|
||||
/**
|
||||
* Tests file tokens.
|
||||
*
|
||||
* @group token
|
||||
*/
|
||||
class FileTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('file');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('file');
|
||||
}
|
||||
|
||||
function testFileTokens() {
|
||||
// Create a test file object.
|
||||
$file = entity_create('file', array(
|
||||
'fid' => 1,
|
||||
'filename' => 'test.png',
|
||||
'filesize' => 100,
|
||||
'uri' => 'public://images/test.png',
|
||||
'filemime' => 'image/png',
|
||||
));
|
||||
|
||||
$tokens = array(
|
||||
'basename' => 'test.png',
|
||||
'extension' => 'png',
|
||||
'size-raw' => 100,
|
||||
);
|
||||
$this->assertTokens('file', array('file' => $file), $tokens);
|
||||
|
||||
// Test a file with no extension and a fake name.
|
||||
$file->filename = 'Test PNG image';
|
||||
$file->uri = 'public://images/test';
|
||||
|
||||
$tokens = array(
|
||||
'basename' => 'test',
|
||||
'extension' => '',
|
||||
'size-raw' => 100,
|
||||
);
|
||||
$this->assertTokens('file', array('file' => $file), $tokens);
|
||||
}
|
||||
}
|
Reference in a new issue