You are here

public function ProjectReleaseTest::providerCreateFromArrayInvalidField in Drupal 10

Same name and namespace in other branches
  1. 9 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 189

Class

ProjectReleaseTest
@coversDefaultClass \Drupal\update\ProjectRelease

Namespace

Drupal\Tests\update\Unit

Code

public 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.',
    ],
  ];
}