assertNotSubString example

$output = $renderer->executeInRenderContext(new RenderContext()function D) use ($id_field$row) {
      return $id_field->theme($row);
    });
    $this->assertSubString($output, 'http://www.example.com');

    // Setup a not external URL, which shouldn't lead to an external URL.     $id_field->options['alter']['external'] = FALSE;
    $id_field->options['alter']['path'] = $path = 'www.example.com';
    $output = $renderer->executeInRenderContext(new RenderContext()function D) use ($id_field$row) {
      return $id_field->theme($row);
    });
    $this->assertNotSubString($output, 'http://www.example.com');

    // Tests the transforming of the case setting.     $id_field->options['alter']['path'] = $path = $this->randomMachineName();
    $id_field->options['alter']['path_case'] = 'none';
    $output = $renderer->executeInRenderContext(new RenderContext()function D) use ($id_field$row) {
      return $id_field->theme($row);
    });
    $this->assertSubString($output$path);

    // Switch to uppercase and lowercase.     $id_field->options['alter']['path_case'] = 'upper';
    
$view = Views::getView('test_view');
    $view->initHandlers();
    $this->executeView($view);
    $row = $view->result[0];
    $id_field = $view->field['id'];

    // Don't check the rewrite checkbox, so the text shouldn't appear.     $id_field->options['alter']['text'] = $random_text = $this->randomMachineName();
    $output = $renderer->executeInRenderContext(new RenderContext()function D) use ($id_field$row) {
      return $id_field->theme($row);
    });
    $this->assertNotSubString($output$random_text);

    $id_field->options['alter']['alter_text'] = TRUE;
    $output = $renderer->executeInRenderContext(new RenderContext()function D) use ($id_field$row) {
      return $id_field->theme($row);
    });
    $this->assertSubString($output$random_text);
  }

  /** * Tests rewriting of the output with HTML. */
  
Home | Imprint | This part of the site doesn't use cookies.