public function FileEntityPathautoTest::testPathauto in File Entity (fieldable files) 8.2
Tests Pathauto support.
File
- tests/
src/ Functional/ FileEntityPathautoTest.php, line 29
Class
- FileEntityPathautoTest
- Tests Pathauto support.
Namespace
Drupal\Tests\file_entity\FunctionalCode
public function testPathauto() {
$pattern = PathautoPattern::create([
'id' => mb_strtolower($this
->randomMachineName()),
'type' => 'canonical_entities:file',
'pattern' => '/files/[file:name]',
'weight' => 0,
]);
$pattern
->save();
$file = $this
->createFileEntity([
'filename' => 'example.png',
]);
$this
->assertPathAliasExists('/files/examplepng', NULL, NULL, 'file alias exists');
}