function ProjectReleaseTest::providerCreateFromArray

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

Data provider for testCreateFromArray().

Return value

mixed Test cases for testCreateFromArray().

File

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

Class

ProjectReleaseTest
@coversDefaultClass \Drupal\update\ProjectRelease

Namespace

Drupal\Tests\update\Unit

Code

public static function providerCreateFromArray() : array {
    return [
        'default valid' => [
            'data' => [],
        ],
        'valid with extra field' => [
            'data' => [
                'extra' => 'This value is ignored and will not trigger a validation error.',
            ],
        ],
        'no release types' => [
            'data' => [
                'terms' => [
                    'Release type' => [],
                ],
            ],
            'expected' => [
                'is_unsupported' => FALSE,
                'is_security_release' => FALSE,
                'is_insecure' => FALSE,
            ],
        ],
        'unpublished' => [
            'data' => [
                'status' => 'unpublished',
            ],
            'expected' => [
                'is_published' => FALSE,
            ],
        ],
        'core_compatible false' => [
            'data' => [
                'core_compatible' => FALSE,
            ],
        ],
        'core_compatible NULL' => [
            'data' => [
                'core_compatible' => NULL,
            ],
        ],
    ];
}

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