1 backdrop_web_test_case.php protected BackdropWebTestCase::backdropSetContent($content, $url = 'internal:')

Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page.

A good example would be when testing backdrop_http_request(). After fetching the page the content can be set and page elements can be checked to ensure that the function worked properly.

File

core/modules/simpletest/backdrop_web_test_case.php, line 3117

Class

BackdropWebTestCase
Test case for typical Backdrop tests.

Code

protected function backdropSetContent($content, $url = 'internal:') {
  $this->content = $content;
  $this->url = $url;
  $this->plainTextContent = FALSE;
  $this->elements = FALSE;
  $this->backdropSettings = array();
  if (preg_match('/window.Backdrop[ ]?=[ ]?{settings:[ ]?(.*)}/', $content, $matches)) {
    $this->backdropSettings = backdrop_json_decode($matches[1]);
  }
}