You are here

public static function FrontMatterTest::providerFrontMatterData in Drupal 9

Provides the front matter data to test.

Return value

array Array of front matter data.

File

core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php, line 105

Class

FrontMatterTest
Tests front matter parsing helper methods.

Namespace

Drupal\Tests\Component\FrontMatter

Code

public static function providerFrontMatterData() {
  $data['none'] = [
    'yaml' => NULL,
    'line' => 1,
  ];
  $data['scalar'] = [
    'yaml' => [
      'string' => 'value',
      'number' => 42,
      'bool' => TRUE,
      'null' => NULL,
    ],
    'line' => 7,
  ];
  $data['indexed_arrays'] = [
    'yaml' => [
      'brackets' => [
        1,
        2,
        3,
      ],
      'items' => [
        'item1',
        'item2',
        'item3',
      ],
    ],
    'line' => 11,
  ];
  $data['associative_arrays'] = [
    'yaml' => [
      'brackets' => [
        'a' => 1,
        'b' => 2,
        'c' => 3,
      ],
      'items' => [
        'a' => 'item1',
        'b' => 'item2',
        'c' => 'item3',
      ],
    ],
    'line' => 11,
  ];
  $data['empty_data'] = [
    'yaml' => [],
    'line' => 3,
  ];
  $data['empty_content'] = [
    'yaml' => [
      'key' => 'value',
    ],
    'line' => 4,
    'content' => '',
  ];
  $data['empty_data_and_content'] = [
    'yaml' => [],
    'line' => 3,
    'content' => '',
  ];
  $data['empty_string'] = [
    'yaml' => NULL,
    'line' => 1,
    'content' => '',
  ];
  $data['multiple_separators'] = [
    'yaml' => [
      'key' => '---',
    ],
    'line' => 4,
    'content' => "Something\n---\nSomething more",
  ];
  return $data;
}