Commit 2f1345a9 authored by alexpott's avatar alexpott

Issue #2421699 by JeroenT: Remove usage of deprecated functions of WebTestBase

parent 374a5bdc
......@@ -68,7 +68,7 @@ function testBlockRenderOrder() {
}
$this->drupalGet('');
$test_content = $this->drupalGetContent('');
$test_content = $this->getRawContent('');
$controller = $this->container->get('entity.manager')->getStorage('block');
foreach ($controller->loadMultiple() as $return_block) {
......
......@@ -74,10 +74,10 @@ function testRecentCommentBlock() {
$this->assertText($comments[$i]->getSubject(), String::format('Comment @number found in block.', array('@number' => 10 - $i)));
if ($i > 1) {
$previous_position = $position;
$position = strpos($this->drupalGetContent(), $comments[$i]->getSubject());
$position = strpos($this->getRawContent(), $comments[$i]->getSubject());
$this->assertTrue($position > $previous_position, String::format('Comment @a appears after comment @b', array('@a' => 10 - $i, '@b' => 11 - $i)));
}
$position = strpos($this->drupalGetContent(), $comments[$i]->getSubject());
$position = strpos($this->getRawContent(), $comments[$i]->getSubject());
}
// Test that links to comments work when comments are across pages.
......
......@@ -186,7 +186,7 @@ function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
$regex .= $comment->comment_body->value . '(.*?)';
$regex .= '/s';
return (boolean) preg_match($regex, $this->drupalGetContent());
return (boolean) preg_match($regex, $this->getRawContent());
}
else {
return FALSE;
......@@ -200,7 +200,7 @@ function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
* Contact info is available.
*/
function commentContactInfoAvailable() {
return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->drupalGetContent());
return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->getRawContent());
}
/**
......@@ -239,7 +239,7 @@ function performCommentOperation($comment, $operation, $approval = FALSE) {
*/
function getUnapprovedComment($subject) {
$this->drupalGet('admin/content/comment/approval');
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match);
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->getRawContent(), $match);
return $match[2];
}
......
......@@ -193,7 +193,7 @@ function commentExists(CommentInterface $comment = NULL, $reply = FALSE) {
$regex .= ($reply ? '</article>\s</div>(.*?)' : '');
$regex .= '!s';
return (boolean) preg_match($regex, $this->drupalGetContent());
return (boolean) preg_match($regex, $this->getRawContent());
}
else {
return FALSE;
......@@ -326,7 +326,7 @@ public function setCommentSettings($name, $value, $message, $field_name = 'comme
* Contact info is available.
*/
function commentContactInfoAvailable() {
return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->drupalGetContent());
return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->getRawContent());
}
/**
......@@ -365,7 +365,7 @@ function performCommentOperation(CommentInterface $comment, $operation, $approva
*/
function getUnapprovedComment($subject) {
$this->drupalGet('admin/content/comment/approval');
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match);
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->getRawContent(), $match);
return $match[2];
}
......
......@@ -127,7 +127,7 @@ public function testExportImport() {
// Export the configuration.
$this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export');
$this->tarball = $this->drupalGetContent();
$this->tarball = $this->getRawContent();
$this->config('system.site')
->set('slogan', $this->originalSlogan)
......@@ -184,7 +184,7 @@ public function testExportImportCollections() {
// Export the configuration.
$this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export');
$this->tarball = $this->drupalGetContent();
$this->tarball = $this->getRawContent();
$filename = file_directory_temp() .'/' . $this->randomMachineName();
file_put_contents($filename, $this->tarball);
......
......@@ -47,7 +47,7 @@ function testExport() {
$this->assertResponse(200, 'User can access the download callback.');
// Get the archived binary file provided to user for download.
$archive_data = $this->drupalGetContent();
$archive_data = $this->getRawContent();
// Temporarily save the archive file.
$uri = file_unmanaged_save_data($archive_data, 'temporary://config.tar.gz');
......
......@@ -131,7 +131,7 @@ public function testContentTranslationContextualLinks() {
$response = $this->renderContextualLinks(array('node:node=1:'), 'node/' . $node->id());
$this->assertResponse(200);
$json = Json::decode($response);
$this->drupalSetContent($json['node:node=1:']);
$this->setRawContent($json['node:node=1:']);
$this->assertLinkByHref($translate_link, 0, 'The contextual link to translate the node is shown.');
// Check that the link leads to the translate page.
......
......@@ -491,7 +491,7 @@ protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
$display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
$build = $display->build($entity);
$output = drupal_render($build);
$this->drupalSetContent($output);
$this->setRawContent($output);
$this->verbose($output);
}
......
......@@ -54,9 +54,9 @@ public function testNoEditorAvailable() {
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
// Ensure the form field order is correct.
$roles_pos = strpos($this->drupalGetContent(), 'Roles');
$editor_pos = strpos($this->drupalGetContent(), 'Text editor');
$filters_pos = strpos($this->drupalGetContent(), 'Enabled filters');
$roles_pos = strpos($this->getRawContent(), 'Roles');
$editor_pos = strpos($this->getRawContent(), 'Text editor');
$filters_pos = strpos($this->getRawContent(), 'Enabled filters');
$this->assertTrue($roles_pos < $editor_pos && $editor_pos < $filters_pos, '"Text Editor" select appears in the correct location of the text format configuration UI.');
// Verify the <select>.
......
......@@ -115,7 +115,7 @@ function testBooleanField() {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertRaw('<div class="field-item">' . $on . '</div>');
// Test the display_label option.
......
......@@ -103,7 +103,7 @@ function testEmailField() {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertLinkByHref('mailto:test@example.com');
}
......
......@@ -97,7 +97,7 @@ function _testTextfieldWidgets($field_type, $widget_type) {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertText($value, 'Filtered tags are not displayed');
}
}
......@@ -447,7 +447,7 @@ function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $text, $mes
\Drupal::entityManager()->clearCachedFieldDefinitions();
// Save current content so that we can restore it when we're done.
$old_content = $this->drupalGetContent();
$old_content = $this->getRawContent();
// Render a cloned node, so that we do not alter the original.
$clone = clone $node;
......@@ -456,12 +456,12 @@ function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $text, $mes
$this->verbose(t('Rendered node - view mode: @view_mode', array('@view_mode' => $view_mode)) . '<hr />'. $output);
// Assign content so that WebTestBase functions can be used.
$this->drupalSetContent($output);
$this->setRawContent($output);
$method = ($not_exists ? 'assertNoText' : 'assertText');
$return = $this->{$method}((string) $text, $message);
// Restore previous content.
$this->drupalSetContent($old_content);
$this->setRawContent($old_content);
return $return;
}
......
......@@ -101,7 +101,7 @@ function testFileListingPages() {
$this->assertLinkByHref(file_create_url($file->getFileUri()));
$this->assertLinkByHref('admin/content/files/usage/' . $file->id());
}
$this->assertFalse(preg_match('/views-field-status priority-low\">\s*' . t('Temporary') . '/', $this->drupalGetContent()), 'All files are stored as permanent.');
$this->assertFalse(preg_match('/views-field-status priority-low\">\s*' . t('Temporary') . '/', $this->getRawContent()), 'All files are stored as permanent.');
// Use one file two times and check usage information.
$orphaned_file = $nodes[1]->file->target_id;
......
......@@ -70,7 +70,7 @@ public function testHandlers() {
$this->executeView($view);
$this->assertEqual(count($view->result), 2);
$output = $view->preview();
$this->drupalSetContent(drupal_render($output));
$this->setRawContent(drupal_render($output));
$result = $this->xpath('//span[@class=:class]', array(':class' => 'marker'));
$this->assertEqual(count($result), 1, 'Just one node is marked as new');
......
......@@ -92,7 +92,7 @@ function testImageFormatterTheme() {
// Test using theme_image_formatter() with a NULL value for the alt option.
$element = $base_element;
$this->drupalSetContent(drupal_render($element));
$this->setRawContent(drupal_render($element));
$elements = $this->xpath('//a[@href=:path]/img[@class="image-style-test" and @src=:url and @width=:width and @height=:height]', array(':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()));
$this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders with a NULL value for the alt option.');
......@@ -100,7 +100,7 @@ function testImageFormatterTheme() {
// link options.
$element = $base_element;
$element['#item']->alt = '';
$this->drupalSetContent(drupal_render($element));
$this->setRawContent(drupal_render($element));
$elements = $this->xpath('//a[@href=:path]/img[@class="image-style-test" and @src=:url and @width=:width and @height=:height and @alt=""]', array(':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()));
$this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders without title, alt, or path options.');
......@@ -108,7 +108,7 @@ function testImageFormatterTheme() {
$fragment = $this->randomMachineName();
$element = $base_element;
$element['#url'] = Url::fromRoute('<none>', [], ['fragment' => $fragment]);
$this->drupalSetContent(drupal_render($element));
$this->setRawContent(drupal_render($element));
$elements = $this->xpath('//a[@href=:fragment]/img[@class="image-style-test" and @src=:url and @width=:width and @height=:height and @alt=""]', array(
':fragment' => '#' . $fragment,
':url' => $url,
......@@ -140,14 +140,14 @@ function testImageStyleTheme() {
);
$element = $base_element;
$this->drupalSetContent(drupal_render($element));
$this->setRawContent(drupal_render($element));
$elements = $this->xpath('//img[@class="image-style-image-test" and @src=:url and @alt=""]', array(':url' => $url));
$this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly.');
// Test using theme_image_style() with a NULL value for the alt option.
$element = $base_element;
$element['#alt'] = NULL;
$this->drupalSetContent(drupal_render($element));
$this->setRawContent(drupal_render($element));
$elements = $this->xpath('//img[@class="image-style-image-test" and @src=:url]', array(':url' => $url));
$this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly with a NULL value for the alt option.');
}
......@@ -167,7 +167,7 @@ function testImageAltFunctionality() {
'#attributes' => array('class' => 'image-with-regular-alt', 'id' => 'my-img'),
);
$this->drupalSetContent(drupal_render($image_with_alt_property));
$this->setRawContent(drupal_render($image_with_alt_property));
$elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', array(":class" => "image-with-regular-alt", ":alt" => "Regular alt"));
$this->assertEqual(count($elements), 1, 'Regular alt displays correctly');
......@@ -185,7 +185,7 @@ function testImageAltFunctionality() {
),
);
$this->drupalSetContent(drupal_render($image_with_alt_attribute_alt_attribute));
$this->setRawContent(drupal_render($image_with_alt_attribute_alt_attribute));
$elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', array(":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"));
$this->assertEqual(count($elements), 1, 'Attribute alt displays correctly');
......@@ -204,7 +204,7 @@ function testImageAltFunctionality() {
),
);
$this->drupalSetContent(drupal_render($image_with_alt_attribute_both));
$this->setRawContent(drupal_render($image_with_alt_attribute_both));
$elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', array(":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"));
$this->assertEqual(count($elements), 1, 'Attribute alt overrides alt property if both set.');
}
......
......@@ -583,7 +583,7 @@ protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), $view_mode);
$content = $display->build($entity);
$output = drupal_render($content);
$this->drupalSetContent($output);
$this->setRawContent($output);
$this->verbose($output);
}
......
......@@ -30,7 +30,7 @@ public function testSummaryLength() {
// Render the node as a teaser.
$content = $this->drupalBuildEntityView($node, 'teaser');
$this->assertTrue(strlen($content['body'][0]['#markup']) < 600, 'Teaser is less than 600 characters long.');
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
// The string 'What is a Drupalism?' is between the 200th and 600th
// characters of the node body, so it should be included if the summary is
// 600 characters long.
......@@ -48,7 +48,7 @@ public function testSummaryLength() {
// 200 characters in length and so does not include 'What is a Drupalism?'.
$content = $this->drupalBuildEntityView($node, 'teaser');
$this->assertTrue(strlen($content['body'][0]['#markup']) < 200, 'Teaser is less than 200 characters long.');
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertText($node->label());
$this->assertNoRaw($expected);
}
......
......@@ -45,7 +45,7 @@ public function testNodeContextualLinks() {
$response = $this->renderContextualLinks(array('node:node=1:'), 'node');
$this->assertResponse(200);
$json = Json::decode($response);
$this->drupalSetContent($json['node:node=1:']);
$this->setRawContent($json['node:node=1:']);
// @todo Add these back when the functionality for making Views displays
// appear in contextual links is working again.
......
......@@ -164,7 +164,7 @@ public function testAutocompleteQuickEdit() {
$response = $this->drupalPost($quickedit_uri, 'application/vnd.drupal-ajax', $post);
$this->assertResponse(200);
$ajax_commands = Json::decode($response);
$this->drupalSetContent($ajax_commands[0]['data']);
$this->setRawContent($ajax_commands[0]['data']);
$this->assertLink($this->term1->getName());
$this->assertLink($this->term2->getName());
$this->assertText('new term');
......@@ -180,7 +180,7 @@ public function testAutocompleteQuickEdit() {
// the form to edit the taxonomy term field, it should contain all three
// taxonomy terms, including the one that has just been newly created and
// which is not yet stored.
$this->drupalSetContent($ajax_commands[0]['data']);
$this->setRawContent($ajax_commands[0]['data']);
$this->assertFieldByName($this->fieldName, implode(', ', array($this->term1->getName(), 'new term', $this->term2->label())));
// Save the entity.
......
......@@ -50,7 +50,7 @@ function testXPathEscaping() {
</body>
</html>
EOF;
$this->drupalSetContent($testpage);
$this->setRawContent($testpage);
// Matches the first link.
$urls = $this->xpath('//a[text()=:text]', array(':text' => 'A "weird" link, just to bother the dumb "XPath 1.0"'));
......
......@@ -173,7 +173,7 @@ public function testDialog() {
],
];
$this->assertEqual($expected_ajax_settings, $ajax_result[0]['settings']['ajax']);
$this->drupalSetContent($ajax_result[3]['data']);
$this->setRawContent($ajax_result[3]['data']);
// Remove the data, the form build id and token will never match.
unset($ajax_result[3]['data']);
$form = $this->xpath("//form[@id='ajax-test-form']");
......@@ -189,7 +189,7 @@ public function testDialog() {
// Emulate going to the JS version of the form and check the JSON response.
$ajax_result = $this->drupalGetAJAX('admin/structure/contact/add', array(), array('Accept: application/vnd.drupal-modal'));
$this->drupalSetContent($ajax_result[3]['data']);
$this->setRawContent($ajax_result[3]['data']);
// Remove the data, the form build id and token will never match.
unset($ajax_result[3]['data']);
$form = $this->xpath("//form[@id='contact-form-add-form']");
......
......@@ -234,14 +234,14 @@ function testPageCompression() {
// Fill the cache and verify that output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
$this->setRawContent(gzinflate(substr($this->getRawContent(), 10, -8)));
$this->assertRaw('</html>', 'Page was gzip compressed.');
// Verify that cached output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', 'A Content-Encoding header was sent.');
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
$this->setRawContent(gzinflate(substr($this->getRawContent(), 10, -8)));
$this->assertRaw('</html>', 'Page was gzip compressed.');
// Verify that a client without compression support gets an uncompressed page.
......@@ -257,7 +257,7 @@ function testPageCompression() {
// Verify if cached page is still available for a client with compression support.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
$this->setRawContent(gzinflate(substr($this->getRawContent(), 10, -8)));
$this->assertRaw('</html>', 'Page was delivered after compression mode is changed (compression support enabled).');
// Verify if cached page is still available for a client without compression support.
......
......@@ -63,7 +63,7 @@ function testBasicFeedAddNoTitle() {
drupal_process_attached($build);
$this->drupalSetContent(drupal_get_html_head());
$this->setRawContent(drupal_get_html_head());
foreach ($urls as $description => $feed_info) {
$this->assertPattern($this->urlToRSSLinkPattern($feed_info['url'], $feed_info['title']), format_string('Found correct feed header for %description', array('%description' => $description)));
}
......
......@@ -149,8 +149,8 @@ function testDrupalRenderFormElements() {
*/
protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
$original_element = $element;
$this->drupalSetContent(drupal_render_root($element));
$this->verbose('<hr />' . $this->drupalGetContent());
$this->setRawContent(drupal_render_root($element));
$this->verbose('<hr />' . $this->getRawContent());
// @see \Drupal\simpletest\WebTestBase::xpath()
$xpath = $this->buildXPathQuery($xpath, $xpath_args);
......
......@@ -39,7 +39,7 @@ function testEvenPagerQuery() {
for ($page = 0; $page <= $num_pages; ++$page) {
$this->drupalGet('database_test/pager_query_even/' . $limit, array('query' => array('page' => $page)));
$data = json_decode($this->drupalGetContent());
$data = json_decode($this->getRawContent());
if ($page == $num_pages) {
$correct_number = $count - ($limit * $page);
......@@ -73,7 +73,7 @@ function testOddPagerQuery() {
for ($page = 0; $page <= $num_pages; ++$page) {
$this->drupalGet('database_test/pager_query_odd/' . $limit, array('query' => array('page' => $page)));
$data = json_decode($this->drupalGetContent());
$data = json_decode($this->getRawContent());
if ($page == $num_pages) {
$correct_number = $count - ($limit * $page);
......
......@@ -32,7 +32,7 @@ function testTableSortQuery() {
foreach ($sorts as $sort) {
$this->drupalGet('database_test/tablesort/', array('query' => array('order' => $sort['field'], 'sort' => $sort['sort'])));
$data = json_decode($this->drupalGetContent());
$data = json_decode($this->getRawContent());
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
......@@ -60,7 +60,7 @@ function testTableSortQueryFirst() {
foreach ($sorts as $sort) {
$this->drupalGet('database_test/tablesort_first/', array('query' => array('order' => $sort['field'], 'sort' => $sort['sort'])));
$data = json_decode($this->drupalGetContent());
$data = json_decode($this->getRawContent());
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
......
......@@ -33,7 +33,7 @@ function countTableRows($table_name) {
*/
function testTemporaryQuery() {
$this->drupalGet('database_test/db_query_temporary');
$data = json_decode($this->drupalGetContent());
$data = json_decode($this->getRawContent());
if ($data) {
$this->assertEqual($this->countTableRows('test'), $data->row_count, 'The temporary table contains the correct amount of rows.');
$this->assertFalse(db_table_exists($data->table_name), 'The temporary table is, indeed, temporary.');
......
......@@ -338,7 +338,7 @@ function testSelect() {
'multiple_no_default_required[]' => 'three',
);
$this->drupalPostForm(NULL, $edit, 'Submit');
$values = Json::decode($this->drupalGetContent());
$values = Json::decode($this->getRawContent());
// Verify expected values.
$expected = array(
......
......@@ -88,7 +88,7 @@ function testHiddenLanguageSelectElement() {
// field elements.
$edit = array();
$this->drupalPostForm(NULL, $edit, t('Submit'));
$values = Json::decode($this->drupalGetContent());
$values = Json::decode($this->getRawContent());
$this->assertEqual($values['languages_all'], 'xx');
$this->assertEqual($values['languages_configurable'], 'en');
$this->assertEqual($values['languages_locked'], LanguageInterface::LANGCODE_NOT_SPECIFIED);
......
......@@ -54,7 +54,7 @@ function testSessionSaveRegenerate() {
$user->save();
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID before logging in.');
$original_session = $matches[1];
......@@ -71,7 +71,7 @@ function testSessionSaveRegenerate() {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID after logging in.');
$this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
}
......
......@@ -42,7 +42,7 @@ function testShutdownFunctions() {
// If using PHP-FPM then fastcgi_finish_request() will have been fired
// returning the response before shutdown functions have fired.
// @see \Drupal\system_test\Controller\SystemTestController::shutdownFunctions()
$server_using_fastcgi = strpos($this->drupalGetContent(), 'The function fastcgi_finish_request exists when serving the request.');
$server_using_fastcgi = strpos($this->getRawContent(), 'The function fastcgi_finish_request exists when serving the request.');
if ($server_using_fastcgi) {
// We need to wait to ensure that the shutdown functions have fired.
sleep(1);
......
......@@ -57,7 +57,7 @@ public function testTwigUrlGenerator() {
'url (as route) absolute with fragment: ' . $url_generator->generateFromRoute('user.register', array(), array('absolute' => TRUE, 'fragment' => 'bottom')),
);
// Make sure we got something.
$content = $this->drupalGetContent();
$content = $this->getRawContent();
$this->assertFalse(empty($content), 'Page content is not empty');
foreach ($expected as $string) {
$this->assertRaw('<div>' . $string . '</div>');
......
......@@ -112,7 +112,7 @@ function testSpecificSuggestionsAlter() {
$this->resetAll();
$this->drupalGet('theme-test/specific-suggestion-alter');
$this->assertText('Template overridden based on suggestion alter hook determined by the base hook.');
$this->assertTrue(strpos($this->drupalGetContent(), 'theme_test_specific_suggestions__variant') < strpos($this->drupalGetContent(), 'theme_test_specific_suggestions__variant__foo'), 'Specific theme call is added to the suggestions array before the suggestions alter hook.');
$this->assertTrue(strpos($this->getRawContent(), 'theme_test_specific_suggestions__variant') < strpos($this->getRawContent(), 'theme_test_specific_suggestions__variant__foo'), 'Specific theme call is added to the suggestions array before the suggestions alter hook.');
}
/**
......
......@@ -42,7 +42,7 @@ public function testTwigWithoutFilter() {
),
);
$rendered = drupal_render($filter_test);
$this->drupalSetContent($rendered);
$this->setRawContent($rendered);
$elements = array(
array(
......
......@@ -58,7 +58,7 @@ public function testTemplateDiscovery() {
public function testTwigNamespaces() {
// Test twig @extends and @include in template files.
$test = array('#theme' => 'twig_namespace_test');
$this->drupalSetContent(drupal_render($test));
$this->setRawContent(drupal_render($test));
$this->assertText('This line is from twig_namespace_a/templates/test.html.twig');
$this->assertText('This line is from twig_namespace_b/templates/test.html.twig');
......
......@@ -33,7 +33,7 @@ public function testAutoescapeRaw() {
'#script' => '<script>alert("This alert is real because I will put it through the raw filter!");</script>',
);
$rendered = drupal_render($test);
$this->drupalSetContent($rendered);
$this->setRawContent($rendered);
$this->assertRaw('<script>alert("This alert is real because I will put it through the raw filter!");</script>');
}
......
......@@ -115,7 +115,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertText($term1->getName(), 'Term 1 name is displayed.');
$this->assertText($term2->getName(), 'Term 2 name is displayed.');
......@@ -126,7 +126,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
// Term 1 should still be displayed; term 2 should not be.
$this->assertText($term1->getName(), 'Term 1 name is displayed.');
......
......@@ -132,7 +132,7 @@ function testTaxonomyTermFieldWidgets() {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertText($term->getName(), 'Term label is displayed.');
// Delete the vocabulary and verify that the widget is gone.
......
......@@ -139,7 +139,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertNoRaw($value, 'HTML tags are not displayed.');
$this->assertEscaped($value, 'Escaped HTML is displayed correctly.');
......@@ -178,7 +178,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
$entity = entity_load('entity_test', $id);
$display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full');
$content = $display->build($entity);
$this->drupalSetContent(drupal_render($content));
$this->setRawContent(drupal_render($content));
$this->assertRaw($value, 'Value is displayed unfiltered');
}
......
......@@ -159,7 +159,7 @@ function testUpdateContribOrder() {
// we're really testing that the project listings are in the right order.
$bbb_project_link = '<div class="project"><a href="http://example.com/project/bbb_update_test">BBB Update test</a>';
$ccc_project_link = '<div class="project"><a href="http://example.com/project/ccc_update_test">CCC Update test</a>';
$this->assertTrue(strpos($this->drupalGetContent(), $bbb_project_link) < strpos($this->drupalGetContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project");
$this->assertTrue(strpos($this->getRawContent(), $bbb_project_link) < strpos($this->getRawContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project");
}
/**
......
......@@ -94,12 +94,12 @@ function testWhosOnlineBlock() {
// Test block output.
\Drupal::currentUser()->setAccount($user1);
$content = entity_view($block, 'block');
$this->drupalSetContent(render($content));
$this->setRawContent(render($content));
$this->assertRaw(t('2 users'), 'Correct number of online users (2 users).');
$this->assertText($user1->getUsername(), 'Active user 1 found in online list.');
$this->assertText($user2->getUsername(), 'Active user 2 found in online list.');
$this->assertNoText($user3->getUsername(), 'Inactive user not found in online list.');
$this->assertTrue(strpos($this->drupalGetContent(), $user1->getUsername()) > strpos($this->drupalGetContent(), $user2->getUsername()), 'Online users are ordered correctly.');
$this->assertTrue(strpos($this->getRawContent(), $user1->getUsername()) > strpos($this->getRawContent(), $user2->getUsername()), 'Online users are ordered correctly.');
}
/**
......
......@@ -176,7 +176,7 @@ public function testReadMore() {
$output = $view->preview();
$output = drupal_render($output);
$this->drupalSetContent($output);
$this->setRawContent($output);
$result = $this->xpath('//a[@class=:class]', array(':class' => 'more-link'));
$this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
......@@ -185,7 +185,7 @@ public function testReadMore() {
// tested.
$more_link = $view->display_handler->renderMoreLink();
$more_link = drupal_render($more_link);
$this->drupalSetContent($more_link);
$this->setRawContent($more_link);
$result = $this->xpath('//a[@class=:class]', array(':class' => 'more-link'));
$this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
......@@ -201,7 +201,7 @@ public function testReadMore() {
$this->executeView($view);
$output = $view->preview();
$output = drupal_render($output);
$this->drupalSetContent($output);
$this->setRawContent($output);
$result = $this->xpath('//a[@class=:class]', array(':class' => 'more-link'));
$this->assertTrue(empty($result), 'The more link is not shown.');
......@@ -219,7 +219,7 @@ public function testReadMore() {
$this->executeView($view);
$output = $view->preview();
$output = drupal_render($output);