You are here

class Test in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php \Test
  2. 8.0 core/modules/system/tests/modules/test_page_test/src/Controller/Test.php \Drupal\test_page_test\Controller\Test
Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/test_page_test/src/Controller/Test.php \Drupal\test_page_test\Controller\Test

Defines a test controller for page titles.

Hierarchy

  • class \Drupal\test_page_test\Controller\Test

Expanded class hierarchy of Test

64 string references to 'Test'
ClientTest::testHandlesRedirectsCorrectly in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testHttps in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
config_translation_test.content.yml in core/modules/config_translation/tests/modules/config_translation_test/config/install/config_translation_test.content.yml
core/modules/config_translation/tests/modules/config_translation_test/config/install/config_translation_test.content.yml
ContentTranslationSettingsTest::testFieldTranslatableSettingsUI in core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
Tests that field setting depends on bundle translatability.
core.entity_view_mode.entity_test.test.yml in core/modules/system/tests/modules/entity_test/config/install/core.entity_view_mode.entity_test.test.yml
core/modules/system/tests/modules/entity_test/config/install/core.entity_view_mode.entity_test.test.yml

... See full list

File

core/modules/system/tests/modules/test_page_test/src/Controller/Test.php, line 14
Contains \Drupal\test_page_test\Controller\Test.

Namespace

Drupal\test_page_test\Controller
View source
class Test {

  /**
   * Renders a page with a title.
   *
   * @return array
   *   A render array as expected by drupal_render()
   */
  public function renderTitle() {
    $build = array();
    $build['#markup'] = 'Hello Drupal';
    $build['#title'] = 'Foo';
    return $build;
  }

  /**
   * Renders a page.
   *
   * @return array
   *   A render array as expected by drupal_render().
   */
  public function staticTitle() {
    $build = array();
    $build['#markup'] = 'Hello Drupal';
    return $build;
  }

  /**
   * Returns a 'dynamic' title for the '_title_callback' route option.
   *
   * @return string
   *   The page title.
   */
  public function dynamicTitle() {
    return 'Dynamic title';
  }

  /**
   * Defines a controller with a cached render array.
   *
   * @return array
   *   A render array
   */
  public function controllerWithCache() {
    $build = [];
    $build['#title'] = '<span>Cached title</span>';
    $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_render()
   */
  public function renderPage() {
    return array(
      '#markup' => 'Content',
    );
  }

  /**
   * Throws a HTTP exception.
   *
   * @param int $code
   *   The status code.
   */
  public function httpResponseException($code) {
    throw new HttpException($code);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Test::controllerWithCache public function Defines a controller with a cached render array.
Test::dynamicTitle public function Returns a 'dynamic' title for the '_title_callback' route option.
Test::httpResponseException public function Throws a HTTP exception.
Test::renderPage public function Returns a generic page render array for title tests.
Test::renderTitle public function Renders a page with a title.
Test::staticTitle public function Renders a page.