Cached title';
$build['#cache']['keys'] = ['test_controller', 'with_title'];
return $build;
}
/**
* Returns a generic page render array for title tests.
*
* @return array
* A render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*/
public function renderPage() {
return [
'#markup' => 'Content',
];
}
/**
* Throws a HTTP exception.
*
* @param int $code
* The status code.
*/
public function httpResponseException($code) {
throw new HttpException($code);
}
public function error() {
trigger_error('foo', E_USER_NOTICE);
return [
'#markup' => 'Content',
];
}
/**
* Renders a page with encoded markup.
*
* @return array
* A render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*/
public function renderEncodedMarkup() {
return ['#plain_text' => 'Bad html '];
}
/**
* Renders a page with pipe character in link test.
*
* @return array
* A render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*/
public function renderPipeInLink() {
return ['#markup' => 'foo|bar|baz'];
}
/**
* Loads a page that does a redirect.
*
* Drupal uses Symfony's RedirectResponse for generating redirects. That class
* uses a lower-case 'http-equiv="refresh"'.
*
* @see \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function metaRefresh() {
return new RedirectResponse(Url::fromRoute('test_page_test.test_page', [], ['absolute' => TRUE])->toString(), 302);
}
}