function ImageFieldValidateTest::providerTestEmpty

Same name in other branches
  1. 8.9.x core/modules/image/tests/src/Functional/ImageFieldValidateTest.php \Drupal\Tests\image\Functional\ImageFieldValidateTest::providerTestEmpty()
  2. 10 core/modules/image/tests/src/Functional/ImageFieldValidateTest.php \Drupal\Tests\image\Functional\ImageFieldValidateTest::providerTestEmpty()
  3. 11.x core/modules/image/tests/src/Functional/ImageFieldValidateTest.php \Drupal\Tests\image\Functional\ImageFieldValidateTest::providerTestEmpty()

Data provider for ::testEmpty()

Return value

array Test cases.

File

core/modules/image/tests/src/Functional/ImageFieldValidateTest.php, line 251

Class

ImageFieldValidateTest
Tests validation functions such as min/max resolution.

Namespace

Drupal\Tests\image\Functional

Code

public function providerTestEmpty() {
    return [
        'optional-single' => [
            'field_image',
            FALSE,
            1,
            'files[field_image_0]',
            'Article Article with edit-access-allowed image field has been created.',
            'Article Article with edit-access-forbidden image field has been created.',
        ],
        'optional-unlimited' => [
            'field_image',
            FALSE,
            FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
            'files[field_image_0][]',
            'Article Article with edit-access-allowed image field has been created.',
            'Article Article with edit-access-forbidden image field has been created.',
        ],
        'optional-multiple-limited' => [
            'field_image',
            FALSE,
            2,
            'files[field_image_0][]',
            'Article Article with edit-access-allowed image field has been created.',
            'Article Article with edit-access-forbidden image field has been created.',
        ],
        'required-single' => [
            'field_image',
            TRUE,
            1,
            'files[field_image_0]',
            'field_image field is required.',
            'field_image field is required.',
        ],
        'required-unlimited' => [
            'field_image',
            TRUE,
            FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
            'files[field_image_0][]',
            'field_image field is required.',
            'field_image field is required.',
        ],
        // @todo Fix this discrepancy in https://www.drupal.org/project/drupal/issues/3011744.
'required-multiple-limited' => [
            'field_image',
            TRUE,
            2,
            'files[field_image_0][]',
            'This value should not be null.',
            'Article Article with edit-access-forbidden image field has been created.',
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.