You are here

protected function HelperTrait::drupalGet 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::drupalGet()

Retrieves a Drupal path and checks for exceptions.

@todo Remove this method once the https://www.drupal.org/i/3137242 mystery is solved.

See also

\Drupal\Tests\UiHelperTrait::drupalGet()

20 calls to HelperTrait::drupalGet()
BlockTest::testBlockExists in tests/src/Functional/BlockTest.php
Tests that the Style Switcher block exists and functions as a normal block.
ConfigTest::setUp in tests/src/Functional/ConfigTest.php
ConfigTest::testActiveStyleOnStyleDelete in tests/src/Functional/ConfigTest.php
Tests active style is replaced with default one when deleted.
ConfigTest::testConfigCustomStyleChangesPath in tests/src/Functional/ConfigTest.php
Tests active style path changes according to the config changes.
CookieTest::testCookie in tests/src/Functional/CookieTest.php
Tests the cookie is set for the whole site.

... See full list

File

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

Class

HelperTrait
Provides helper methods for the Style Switcher testing.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

protected function drupalGet($path, array $options = [], array $headers = []) {
  $out = parent::drupalGet($path, $options, $headers);
  if (strpos($out, 'The website encountered an unexpected error') !== FALSE) {
    $out = preg_replace('/<\\/?br\\s*\\/?>|<pre class="backtrace">/i', PHP_EOL, $out);
    $out = trim(htmlspecialchars_decode(strip_tags($out), ENT_QUOTES));
    throw new \Exception($out);
  }
  return $out;
}