You are here

public function ConfigTest::testConfigCustomStyleChangesPath in Style Switcher 3.0.x

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

Tests active style path changes according to the config changes.

File

tests/src/Functional/ConfigTest.php, line 87

Class

ConfigTest
Tests Style Switcher configs.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

public function testConfigCustomStyleChangesPath() {
  $config = $this
    ->config('styleswitcher.custom_styles');
  $name = array_rand($config
    ->get('styles'));
  $this
    ->drupalGet('');
  $this
    ->click('a.style-switcher.style-' . substr($name, 7));
  $this
    ->assertActiveStylePath($name);
  $new_path = 'new_path';
  $config
    ->set("styles.{$name}.path", $new_path)
    ->save();
  $this
    ->assertActiveStylePath($new_path);
}