function MediaUiFunctionalTest::providerTestMediaReferenceWidget
Same name in other branches
- 9 core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php \Drupal\Tests\media\Functional\MediaUiFunctionalTest::providerTestMediaReferenceWidget()
Data provider for testMediaReferenceWidget().
Return value
array[] Test data. See testMediaReferenceWidget() for the child array structure.
File
-
core/
modules/ media/ tests/ src/ Functional/ MediaUiFunctionalTest.php, line 195
Class
- MediaUiFunctionalTest
- Ensures that media UI works correctly.
Namespace
Drupal\Tests\media\FunctionalCode
public function providerTestMediaReferenceWidget() {
return [
// Single-value fields with a single media type and the default widget:
// - The user can create and list the media.
'single_value:single_type:create_list' => [
1,
[
TRUE,
],
TRUE,
],
// - The user can list but not create the media.
'single_value:single_type:list' => [
1,
[
FALSE,
],
TRUE,
],
// - The user can create but not list the media.
'single_value:single_type:create' => [
1,
[
TRUE,
],
FALSE,
],
// - The user can neither create nor list the media.
'single_value:single_type' => [
1,
[
FALSE,
],
FALSE,
],
// Single-value fields with the tags-style widget:
// - The user can create and list the media.
'single_value:single_type:create_list:tags' => [
1,
[
TRUE,
],
TRUE,
'entity_reference_autocomplete_tags',
],
// - The user can list but not create the media.
'single_value:single_type:list:tags' => [
1,
[
FALSE,
],
TRUE,
'entity_reference_autocomplete_tags',
],
// - The user can create but not list the media.
'single_value:single_type:create:tags' => [
1,
[
TRUE,
],
FALSE,
'entity_reference_autocomplete_tags',
],
// - The user can neither create nor list the media.
'single_value:single_type:tags' => [
1,
[
FALSE,
],
FALSE,
'entity_reference_autocomplete_tags',
],
// Single-value fields with two media types:
// - The user can create both types.
'single_value:two_type:create2_list' => [
1,
[
TRUE,
TRUE,
],
TRUE,
],
// - The user can create only one type.
'single_value:two_type:create1_list' => [
1,
[
TRUE,
FALSE,
],
TRUE,
],
// - The user cannot create either type.
'single_value:two_type:list' => [
1,
[
FALSE,
FALSE,
],
TRUE,
],
// Multiple-value field with a cardinality of 3, with media the user can
// create and list.
'multi_value:single_type:create_list' => [
3,
[
TRUE,
],
TRUE,
],
// The same, with the tags field.
'multi-value:single_type:create_list:tags' => [
3,
[
TRUE,
],
TRUE,
'entity_reference_autocomplete_tags',
],
// Unlimited value field.
'unlimited_value:single_type:create_list' => [
FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
[
TRUE,
],
TRUE,
],
// Unlimited value field with the tags widget.
'unlimited_value:single_type:create_list:tags' => [
FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
[
TRUE,
],
TRUE,
'entity_reference_autocomplete_tags',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.