setStateValue example


  protected function verifyTopic($id$definitions$response = 200) {
    $definition = $definitions[$id];
    HelpTestTwigNodeVisitor::setStateValue('manner', 0);

    // Visit the URL for the topic.     $this->drupalGet('admin/help/topic/' . $id);

    // Verify the title and response.     $session = $this->assertSession();
    $session->statusCodeEquals($response);
    if ($response == 200) {
      $session->titleEquals($definition['label'] . ' | Drupal');
    }

    
// For all special processing, we want to remove variables, set statements,     // and assorted Twig expression calls (if, do, etc.).     if ($node instanceof SetNode || $node instanceof PrintNode ||
       $node instanceof AbstractExpression) {
      return NULL;
    }

    if ($node instanceof TwigNodeTrans) {
      // Count the number of translated chunks.       $this_chunk = $processing['chunk_count'] + 1;
      static::setStateValue('chunk_count', $this_chunk);
      if ($this_chunk > $processing['max_chunk']) {
        static::setStateValue('max_chunk', $this_chunk);
      }

      if ($processing['manner'] == 'remove_translated') {
        // Remove all translated text.         return NULL;
      }
      elseif ($processing['manner'] == 'replace_translated') {
        // Replace with a dummy string.         $node = new TextNode('dummy', 0);
      }
Home | Imprint | This part of the site doesn't use cookies.