function SecurityAdvisoryTest::providerCreateFromArray

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php \Drupal\Tests\system\Unit\SecurityAdvisories\SecurityAdvisoryTest::providerCreateFromArray()
  2. 11.x core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php \Drupal\Tests\system\Unit\SecurityAdvisories\SecurityAdvisoryTest::providerCreateFromArray()

Data provider for testCreateFromArray().

File

core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php, line 48

Class

SecurityAdvisoryTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21system%21src%21SecurityAdvisories%21SecurityAdvisory.php/class/SecurityAdvisory/9" title="Provides a security advisory value object." class="local">\Drupal\system\SecurityAdvisories\SecurityAdvisory</a>

Namespace

Drupal\Tests\system\Unit\SecurityAdvisories

Code

public function providerCreateFromArray() : array {
    return [
        // For 'is_psa' the return value should converted to any array.
[
            [
                'is_psa' => 1,
            ],
            [
                'is_psa' => TRUE,
            ],
        ],
        [
            [
                'is_psa' => '1',
            ],
            [
                'is_psa' => TRUE,
            ],
        ],
        [
            [
                'is_psa' => TRUE,
            ],
            [
                'is_psa' => TRUE,
            ],
        ],
        [
            [
                'is_psa' => 0,
            ],
            [
                'is_psa' => FALSE,
            ],
        ],
        [
            [
                'is_psa' => '0',
            ],
            [
                'is_psa' => FALSE,
            ],
        ],
        [
            [
                'is_psa' => FALSE,
            ],
            [
                'is_psa' => FALSE,
            ],
        ],
        // Test cases that ensure ::isCoreAdvisory only returns TRUE for core.
[
            [
                'type' => 'module',
            ],
        ],
        [
            [
                'type' => 'theme',
            ],
        ],
        [
            [
                'type' => 'core',
            ],
        ],
    ];
}

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