You are here

public function TocFormatterTest::providerConvertHeaderKeysToValues in TOC API 8

Data provider for testConvertHeaderKeysToValues().

See also

testConvertHeaderKeysToValues()

File

tests/src/Unit/TocFormatterTest.php, line 139
Contains \Drupal\Tests\toc_api\Unit\TocFormatterTest.

Class

TocFormatterTest
Tests TOC API formatter.

Namespace

Drupal\Tests\toc_api\Unit

Code

public function providerConvertHeaderKeysToValues() {
  $options = [
    'number_path_truncate' => TRUE,
    'headers' => [
      'h1' => [
        'number_type' => 'decimal',
      ],
      'h2' => [
        'number_type' => 'lower-alpha',
      ],
      'h3' => [
        'number_type' => 'lower-roman',
      ],
    ],
  ];
  $tests[] = [
    [
      'h1' => 2,
      'h2' => 2,
      'h3' => 2,
    ],
    $options,
    [
      'h1' => '2',
      'h2' => 'b',
      'h3' => 'ii',
    ],
  ];
  $tests[] = [
    [
      'h1' => 0,
      'h2' => 2,
      'h3' => 2,
    ],
    $options,
    [
      'h2' => 'b',
      'h3' => 'ii',
    ],
  ];
  $tests[] = [
    [
      'h1' => 2,
      'h2' => 2,
      'h3' => 0,
    ],
    $options,
    [
      'h1' => '2',
      'h2' => 'b',
    ],
  ];
  $tests[] = [
    [
      'h1' => 2,
      'h2' => 2,
      'h3' => 0,
      'h4' => 0,
    ],
    $options,
    [
      'h1' => '2',
      'h2' => 'b',
    ],
  ];
  $tests[] = [
    [
      'h1' => 2,
      'h2' => 0,
      'h3' => 2,
    ],
    $options,
    [
      'h1' => '2',
      'h2' => '0',
      'h3' => 'ii',
    ],
  ];
  $tests[] = [
    [
      'h1' => 2,
      'h2' => 2,
      'h3' => 0,
    ],
    [
      'number_path_truncate' => FALSE,
    ] + $options,
    [
      'h1' => '2',
      'h2' => 'b',
      'h3' => '0',
    ],
  ];
  return $tests;
}