private function SoundCloudWidgetValidationTest::getField in SoundCloud field 8
Get the field for the test with default settings.
2 calls to SoundCloudWidgetValidationTest::getField()
- SoundCloudWidgetValidationTest::testSoundCloudUrlInvalid in src/
Tests/ SoundCloudWidgetValidationTest.php - Test an invalid URLs or strings
- SoundCloudWidgetValidationTest::testSoundCloudUrlValid in src/
Tests/ SoundCloudWidgetValidationTest.php - Test an a valid SoundCloud URL
File
- src/
Tests/ SoundCloudWidgetValidationTest.php, line 139
Class
- SoundCloudWidgetValidationTest
- Test case for custom time field
Namespace
Drupal\soundcloudfield\TestsCode
private function getField() {
$this->fieldName = mb_strtolower($this
->randomMachineName());
//db field
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => 'entity_test',
'type' => 'soundcloud',
'cardinality' => 1,
]);
$this->fieldStorage
->save();
//field type
$this->field = FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'entity_test',
'settings' => [
'title' => DRUPAL_DISABLED,
],
]);
$this->field
->save();
//form display
EntityStorageInterface::load('entity_test.entity_test.default')
->setComponent($this->fieldName, [
'type' => 'soundcloud_url',
])
->save();
//display
EntityDisplayRepositoryInterface::getViewDisplay('entity_test', 'entity_test', 'full')
->setComponent($this->fieldName, [
'type' => 'soundcloud_default',
'settings' => [
'soundcloud_player_type' => 'classic',
'soundcloud_player_width' => 100,
'soundcloud_player_height' => 166,
'soundcloud_player_height_sets' => 450,
'soundcloud_player_visual_height' => 450,
'soundcloud_player_autoplay' => '',
'soundcloud_player_color' => 'ff7700',
'soundcloud_player_hiderelated' => '',
'soundcloud_player_showartwork' => '',
'soundcloud_player_showcomments' => TRUE,
'soundcloud_player_showplaycount' => '',
],
])
->save();
}