FileUrlFieldItemTest.php in File URL 8
File
tests/src/Kernel/FileUrlFieldItemTest.php
View source
<?php
namespace Drupal\Tests\file_url\Kernel;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
class FileUrlFieldItemTest extends FieldKernelTestBase {
public static $modules = [
'file',
'file_url',
];
public function testSelectionHandlerSettings() {
$field_name = Unicode::strtolower($this
->randomMachineName());
$field_storage = FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'entity_test',
'type' => 'file_url',
'settings' => [
'target_type' => 'file',
],
]);
$field_storage
->save();
$field = FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => 'entity_test',
]);
$field
->save();
$field = FieldConfig::load($field
->id());
$this
->assertEquals($field
->getSetting('handler'), 'file_url_default:file');
}
}