function ProjectReleaseTest::providerCreateFromArrayInvalidField

Same name in other branches
  1. 9 core/modules/update/tests/src/Unit/ProjectReleaseTest.php \Drupal\Tests\update\Unit\ProjectReleaseTest::providerCreateFromArrayInvalidField()
  2. 10 core/modules/update/tests/src/Unit/ProjectReleaseTest.php \Drupal\Tests\update\Unit\ProjectReleaseTest::providerCreateFromArrayInvalidField()

Data provider for testCreateFromArrayInvalidField().

File

core/modules/update/tests/src/Unit/ProjectReleaseTest.php, line 191

Class

ProjectReleaseTest
@coversDefaultClass \Drupal\update\ProjectRelease

Namespace

Drupal\Tests\update\Unit

Code

public static function providerCreateFromArrayInvalidField() : array {
    return [
        'status other' => [
            'invalid_field' => 'status',
            'invalid_value' => 'other',
            'expected_message' => 'The value you selected is not a valid choice.',
        ],
        'status non-string' => [
            'invalid_field' => 'status',
            'invalid_value' => new \stdClass(),
            'expected_message' => 'The value you selected is not a valid choice.',
        ],
        'terms non-array' => [
            'invalid_field' => 'terms',
            'invalid_value' => 'Unsupported',
            'expected_message' => 'This value should be of type array.',
        ],
        'version blank' => [
            'invalid_field' => 'version',
            'invalid_value' => '',
            'expected_message' => 'This value should not be blank.',
        ],
        'core_compatibility_message blank' => [
            'invalid_field' => 'core_compatibility_message',
            'invalid_value' => '',
            'expected_message' => 'This value should not be blank.',
        ],
        'download_link blank' => [
            'invalid_field' => 'download_link',
            'invalid_value' => '',
            'expected_message' => 'This value should not be blank.',
        ],
        'release_link blank' => [
            'invalid_field' => 'release_link',
            'invalid_value' => '',
            'expected_message' => 'This value should not be blank.',
        ],
        'date non-numeric' => [
            'invalid_field' => 'date',
            'invalid_value' => '2 weeks ago',
            'expected_message' => 'This value should be of type numeric.',
        ],
        'core_compatible string' => [
            'invalid_field' => 'core_compatible',
            'invalid_value' => 'Nope',
            'expected_message' => 'This value should be of type boolean.',
        ],
    ];
}

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