getRawContent example

$this->drupalSettings = [];
    if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $content$matches)) {
      $this->drupalSettings = Json::decode($matches[1]);
    }
  }

  /** * Retrieves the plain-text content from the current raw content. */
  protected function getTextContent() {
    if (!isset($this->plainTextContent)) {
      $raw_content = $this->getRawContent();
      // Strip everything between the HEAD tags.       $raw_content = preg_replace('@<head>(.+?)</head>@si', '', $raw_content);
      $this->plainTextContent = Xss::filter($raw_content[]);
    }
    return $this->plainTextContent;
  }

  /** * Removes all white-space between HTML tags from the raw content. * * White-space is only removed if there are no non-white-space characters * between HTML tags. * * Use this (once) after performing an operation that sets new raw content, * and when you want to use e.g. assertText() but ignore potential white-space * caused by HTML output templates. */
// Test the rendering of a block.     $entity = Block::load('views_block__who_s_online_who_s_online_block');
    $output = \Drupal::entityTypeManager()
      ->getViewBuilder($entity->getEntityTypeId())
      ->view($entity, 'block');
    $this->setRawContent($this->renderer->renderRoot($output));
    $this->assertRaw('2 users', 'Correct number of online users (2 users).');
    $this->assertText($user1->getAccountName(), 'Active user 1 found in online list.');
    $this->assertText($user2->getAccountName(), 'Active user 2 found in online list.');
    $this->assertNoText($user3->getAccountName(), 'Inactive user not found in online list.');
    // Verify that online users are ordered correctly.     $this->assertGreaterThan(strpos($this->getRawContent()$user2->getAccountName())strpos($this->getRawContent()$user1->getAccountName()));
  }

}
$this->container->get('current_user')
        ->addRole($this->drupalCreateRole(['view own unpublished media']));
    }

    $content = $this->createEmbedCode([
      'data-entity-type' => 'media',
      'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
    ]);
    $result = $this->applyFilter($content);

    if (!$expected_rendered) {
      $this->assertEmpty($this->getRawContent());
    }
    else {
      $this->assertCount(1, $this->cssSelect('div[data-media-embed-test-view-mode="default"]'));
    }

    $this->assertEqualsCanonicalizing($expected_cacheability->getCacheTags()$result->getCacheTags());
    $this->assertEqualsCanonicalizing($expected_cacheability->getCacheContexts()$result->getCacheContexts());
    $this->assertSame($expected_cacheability->getCacheMaxAge()$result->getCacheMaxAge());
    $this->assertSame($expected_attachments$result->getAttachments());
  }

  

    public function build(Enlight_Components_Mail $mail): Log
    {
        $logEntry = new Log();

        $logEntry->setSubject((string) iconv_mime_decode((string) $mail->getSubject()));
        $logEntry->setSender($mail->getFrom());
        $logEntry->setSentAt(new DateTime((string) $mail->getDate()));
        $logEntry->setContentText($mail->getPlainBodyText());

        if ($mail->getBodyHtml() instanceof Zend_Mime_Part) {
            $logEntry->setContentHtml($mail->getBodyHtml()->getRawContent());
        }

        $this->assignType($logEntry$mail->getTemplateName());
        $this->assignOrder($logEntry$mail);
        $this->assignShop($logEntry$mail);

        $this->assignRecipients($logEntryarray_map('trim', $mail->getRecipients()));
        $this->assignDocuments($logEntry$mail);

        return $logEntry;
    }

    

    public function getContent()
    {
        if ($this->_content !== null) {
            return $this->_content;
        }

        if ($this->_mail) {
            return $this->_mail->getRawContent($this->_messageNum);
        } else {
            /** * @see Zend_Mail_Exception */
            throw new Zend_Mail_Exception('no content');
        }
    }

    /** * Return size of part * * Quite simple implemented currently (not decoding). Handle with care. * * @return int size */
Home | Imprint | This part of the site doesn't use cookies.