setTestValue example

/** * Tests that the render function is called. */
  public function testRender() {
    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    $renderer = \Drupal::service('renderer');

    $view = Views::getView('test_field_tokens');
    $this->executeView($view);

    $random_text = $this->randomMachineName();
    $view->field['job']->setTestValue($random_text);
    $output = $renderer->executeInRenderContext(new RenderContext()function D) use ($view) {
      return $view->field['job']->theme($view->result[0]);
    });
    $this->assertEquals($random_text$output, 'Make sure the render method rendered the manual set value.');
  }

  /** * Tests all things related to the query. */
  public function testQuery() {
    // Tests adding additional fields to the query.
Home | Imprint | This part of the site doesn't use cookies.