You are here

public function SmartTitleConfigTest::providerSettingsTestCases in Smart Title 8

Returns the settings test cases.

Return value

array[] Array of data sets to test, each of which is a 'label' indexed array with the following elements:

  • An array of input data, with smart_title__tag, smart_title__classes and smart_title__link submission values.
  • An array of expected settings of the configuration keys mentioned above.

File

tests/src/Functional/SmartTitleConfigTest.php, line 164

Class

SmartTitleConfigTest
Tests the module's title hide functionality.

Namespace

Drupal\Tests\smart_title\Functional

Code

public function providerSettingsTestCases() {
  return [
    'No class, no link' => [
      'input' => [
        'smart_title__tag' => 'span',
        'smart_title__classes' => '',
        'smart_title__link' => 0,
      ],
      'expected' => [
        'smart_title__tag' => 'span',
        'smart_title__classes' => [],
        'smart_title__link' => FALSE,
      ],
    ],
    'Single class without link' => [
      'input' => [
        'smart_title__tag' => 'h3',
        'smart_title__classes' => 'smart-title__test',
        'smart_title__link' => 0,
      ],
      'expected' => [
        'smart_title__tag' => 'h3',
        'smart_title__classes' => [
          'smart-title__test',
        ],
        'smart_title__link' => FALSE,
      ],
    ],
    'Multiple classes, link' => [
      'input' => [
        'smart_title__tag' => 'div',
        'smart_title__classes' => 'smart-title__test with   multiple classes  and space',
        'smart_title__link' => 1,
      ],
      'expected' => [
        'smart_title__tag' => 'div',
        'smart_title__classes' => [
          'smart-title__test',
          'with',
          'multiple',
          'classes',
          'and',
          'space',
        ],
        'smart_title__link' => TRUE,
      ],
    ],
    'Invalid tag and link values' => [
      'input' => [
        'smart_title__tag' => 'invalid',
        'smart_title__classes' => 'valid',
        'smart_title__link' => 'invalid',
      ],
      'expected' => [
        'smart_title__tag' => 'h2',
        'smart_title__classes' => [
          'valid',
        ],
        'smart_title__link' => TRUE,
      ],
    ],
  ];
}