class TestCallables

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\TestCallables
  2. 10 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\TestCallables
  3. 9 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\TestCallables
  4. 8.9.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\TestCallables

Mock callable for testing the pre_render callback.

Hierarchy

Expanded class hierarchy of TestCallables

File

core/tests/Drupal/Tests/Core/Render/RendererTest.php, line 1258

Namespace

Drupal\Tests\Core\Render
View source
class TestCallables implements TrustedCallbackInterface {
  public function preRenderPrinted($elements) {
    $elements['#printed'] = TRUE;
    return $elements;
  }
  public static function lazyBuilder(bool $set_type) : array {
    $build['content'] = [
      '#markup' => 'Content',
    ];
    if ($set_type) {
      $build['#type'] = 'details';
    }
    return $build;
  }
  
  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() : array {
    return [
      'preRenderPrinted',
      'lazyBuilder',
    ];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TestCallables::lazyBuilder public static function
TestCallables::preRenderPrinted public function
TestCallables::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.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.