You are here

class BigPipeSessionlessTestController in Sessionless BigPipe 8

Same name and namespace in other branches
  1. 2.x tests/modules/big_pipe_sessionless_test/src/BigPipeSessionlessTestController.php \Drupal\big_pipe_sessionless_test\BigPipeSessionlessTestController

Hierarchy

Expanded class hierarchy of BigPipeSessionlessTestController

File

tests/modules/big_pipe_sessionless_test/src/BigPipeSessionlessTestController.php, line 8

Namespace

Drupal\big_pipe_sessionless_test
View source
class BigPipeSessionlessTestController extends BigPipeTestController {

  /**
   * {@inheritdoc}
   */
  public function test() {
    $build = parent::test();
    $has_session = \Drupal::service('session_configuration')
      ->hasSession(\Drupal::requestStack()
      ->getMasterRequest());

    // We can't test CSRF tokens for no-session requests.
    if (!$has_session) {
      unset($build['html_attribute_value_subset']);
    }

    // Edge case for no-session (and hence anonymous) responses: active links.
    // @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter
    $build['active_link'] = [
      '#type' => 'link',
      '#title' => 'This should be marked active',
      '#url' => Url::fromRoute('big_pipe_sessionless_test'),
      '#options' => [
        'set_active_class' => TRUE,
      ],
    ];
    $build['inactive_link'] = [
      '#type' => 'link',
      '#title' => 'This should be marked inactive',
      '#url' => Url::fromRoute('<front>'),
      '#options' => [
        'set_active_class' => TRUE,
      ],
    ];
    return $build;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BigPipeSessionlessTestController::test public function Returns a all BigPipe placeholder test case render arrays. Overrides BigPipeTestController::test
BigPipeTestController::counter public static function #lazy_builder callback; returns the current count.
BigPipeTestController::currentTime public static function #lazy_builder callback; builds <time> markup with current time.
BigPipeTestController::exception public static function #lazy_builder callback; throws exception.
BigPipeTestController::helloOrYarhar public static function #lazy_builder callback; says "hello" or "yarhar".
BigPipeTestController::multiOccurrence public function A page with multiple occurrences of the same placeholder.
BigPipeTestController::nope public static function
BigPipeTestController::responseException public static function #lazy_builder callback; returns content that will trigger an exception.
BigPipeTestController::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.