function SecurityAdvisoryTest::getValidData

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

Gets valid data for a security advisory.

Return value

mixed[] The data for the security advisory.

3 calls to SecurityAdvisoryTest::getValidData()
SecurityAdvisoryTest::testCreateFromArray in core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php
Tests creating with valid data.
SecurityAdvisoryTest::testCreateFromArrayInvalidField in core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php
Tests exceptions for invalid field types.
SecurityAdvisoryTest::testCreateFromArrayMissingField in core/modules/system/tests/src/Unit/SecurityAdvisories/SecurityAdvisoryTest.php
Tests exceptions with missing fields.

File

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

Class

SecurityAdvisoryTest
@coversDefaultClass \Drupal\system\SecurityAdvisories\SecurityAdvisory

Namespace

Drupal\Tests\system\Unit\SecurityAdvisories

Code

protected function getValidData() : array {
    return [
        'title' => 'Generic Module1 Test - Moderately critical - Access bypass - SA-CONTRIB-2019-02-02',
        'link' => 'https://www.drupal.org/SA-CONTRIB-2019-02-02',
        'project' => 'generic_module1_test',
        'type' => 'module',
        'is_psa' => FALSE,
        'insecure' => [
            '8.x-1.1',
        ],
        'pubDate' => 'Tue, 19 Mar 2019 12 => 50 => 00 +0000',
        // New fields added to the JSON feed should be ignored and not cause a
        // validation error.
'unknown_field' => 'ignored value',
    ];
}

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