trait FieldRedirectionTestTrait in Field Redirection 8.2
Testing functions for field_redirection.
Hierarchy
- trait \Drupal\Tests\field_redirection\Traits\FieldRedirectionTestTrait
2 files declare their use of FieldRedirectionTestTrait
- FormatterConfigurationTest.php in tests/
src/ Functional/ FormatterConfigurationTest.php - FormatterRedirectTest.php in tests/
src/ Functional/ FormatterRedirectTest.php
File
- tests/
src/ Traits/ FieldRedirectionTestTrait.php, line 12
Namespace
Drupal\Tests\field_redirection\TraitsView source
trait FieldRedirectionTestTrait {
/**
* Sets up a content type with a link field.
*
* @return \Drupal\node\Entity\NodeType
* Created content type.
*/
public function setupContentTypeAndField() {
$contentType = $this
->drupalCreateContentType();
$storage = FieldStorageConfig::create([
'field_name' => 'url',
'entity_type' => 'node',
'type' => 'link',
'cardinality' => 1,
]);
$storage
->save();
FieldConfig::create([
'field_storage' => $storage,
'label' => 'URL',
'bundle' => $contentType
->id(),
'settings' => [
'title' => DRUPAL_DISABLED,
'link_type' => LinkItemInterface::LINK_GENERIC,
],
])
->save();
return $contentType;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FieldRedirectionTestTrait:: |
public | function | Sets up a content type with a link field. |