You are here

protected function HelperTrait::composeStylesMockingPaths in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/HelperTrait.php \Drupal\Tests\styleswitcher\Functional\HelperTrait::composeStylesMockingPaths()

Helps compose the Styles array, mocking styles' paths.

Parameters

string[] $labels: Styles' labels.

string $type: (optional) Style type: "custom" or "theme".

Return value

array[] Styles list as in the config.

2 calls to HelperTrait::composeStylesMockingPaths()
FormTest::testConfigThemeForm in tests/src/Functional/FormTest.php
Tests the config theme form exists and functions properly.
HelperTrait::composeStyleMockingPath in tests/src/Functional/HelperTrait.php
Helps compose a single Style, mocking its path.

File

tests/src/Functional/HelperTrait.php, line 82

Class

HelperTrait
Provides helper methods for the Style Switcher testing.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

protected function composeStylesMockingPaths(array $labels, string $type = 'custom') : array {
  $styles = [];
  foreach ($labels as $label) {
    $name = $type . '/' . strtolower($label);
    $styles[$name] = [
      'name' => $name,
      'label' => $label,
      'path' => $name,
    ];
  }
  return $styles;
}