Issue #2421699 by JeroenT: Remove usage of deprecated functions of WebTestBase
							parent
							
								
									374a5bdc37
								
							
						
					
					
						commit
						2f1345a9ec
					
				| 
						 | 
				
			
			@ -68,7 +68,7 @@ class BlockRenderOrderTest extends WebTestBase {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    $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 @@ class CommentBlockTest extends CommentTestBase {
 | 
			
		|||
      $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 @@ class CommentNonNodeTest extends WebTestBase {
 | 
			
		|||
      $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 @@ class CommentNonNodeTest extends WebTestBase {
 | 
			
		|||
   *   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 @@ class CommentNonNodeTest extends WebTestBase {
 | 
			
		|||
   */
 | 
			
		||||
  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 @@ abstract class CommentTestBase extends WebTestBase {
 | 
			
		|||
      $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 @@ abstract class CommentTestBase extends WebTestBase {
 | 
			
		|||
   *   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 @@ abstract class CommentTestBase extends WebTestBase {
 | 
			
		|||
   */
 | 
			
		||||
  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 @@ class ConfigExportImportUITest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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 @@ class ConfigExportImportUITest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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 @@ class ConfigExportUITest extends WebTestBase {
 | 
			
		|||
    $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 @@ class ContentTranslationContextualLinksTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class DateTimeFieldTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class EditorAdminTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class BooleanFieldTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class EmailFieldTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class StringFieldTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class ManageDisplayTest extends WebTestBase {
 | 
			
		|||
    \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 @@ class ManageDisplayTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class FileListingTest extends FileFieldTestBase {
 | 
			
		|||
      $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 @@ class HistoryTimestampTest extends ViewTestBase {
 | 
			
		|||
    $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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
    // 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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
    );
 | 
			
		||||
 | 
			
		||||
    $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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
      '#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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
      ),
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    $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 @@ class ImageThemeFunctionTest extends WebTestBase {
 | 
			
		|||
      ),
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    $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 @@ class LinkFieldTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class SummaryLengthTest extends NodeTestBase {
 | 
			
		|||
    // 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 @@ class SummaryLengthTest extends NodeTestBase {
 | 
			
		|||
    // 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 @@ class NodeContextualLinksTest extends NodeTestBase {
 | 
			
		|||
    $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 @@ class QuickEditAutocompleteTermTest extends WebTestBase {
 | 
			
		|||
      $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 @@ class QuickEditAutocompleteTermTest extends WebTestBase {
 | 
			
		|||
      // 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 @@ class BrowserTest extends WebTestBase {
 | 
			
		|||
</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 @@ class DialogTest extends AjaxTestBase {
 | 
			
		|||
      ],
 | 
			
		||||
    ];
 | 
			
		||||
    $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 @@ class DialogTest extends AjaxTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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 @@ class PageCacheTest extends WebTestBase {
 | 
			
		|||
    // 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 @@ class PageCacheTest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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 @@ class AddFeedTest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    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 @@ class RenderWebTest extends WebTestBase {
 | 
			
		|||
   */
 | 
			
		||||
  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 @@ class SelectPagerDefaultTest extends DatabaseWebTestBase {
 | 
			
		|||
 | 
			
		||||
    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 @@ class SelectPagerDefaultTest extends DatabaseWebTestBase {
 | 
			
		|||
 | 
			
		||||
    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 @@ class SelectTableSortDefaultTest extends DatabaseWebTestBase {
 | 
			
		|||
 | 
			
		||||
    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 @@ class SelectTableSortDefaultTest extends DatabaseWebTestBase {
 | 
			
		|||
 | 
			
		||||
    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 @@ class TemporaryQueryTest extends DatabaseWebTestBase {
 | 
			
		|||
   */
 | 
			
		||||
  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 @@ class FormTest extends WebTestBase {
 | 
			
		|||
      '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 @@ class LanguageSelectElementTest extends WebTestBase {
 | 
			
		|||
    // 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 @@ class SessionTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class SessionTest extends WebTestBase {
 | 
			
		|||
 | 
			
		||||
    $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 @@ class ShutdownFunctionsTest extends WebTestBase {
 | 
			
		|||
    // 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 @@ class EngineTwigTest extends WebTestBase {
 | 
			
		|||
      '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 @@ class ThemeSuggestionsAlterTest extends WebTestBase {
 | 
			
		|||
    $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 @@ class TwigFilterTest extends WebTestBase {
 | 
			
		|||
      ),
 | 
			
		||||
    );
 | 
			
		||||
    $rendered = drupal_render($filter_test);
 | 
			
		||||
    $this->drupalSetContent($rendered);
 | 
			
		||||
    $this->setRawContent($rendered);
 | 
			
		||||
 | 
			
		||||
    $elements = array(
 | 
			
		||||
      array(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ class TwigNamespaceTest extends WebTestBase {
 | 
			
		|||
  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 @@ class TwigRawTest extends WebTestBase {
 | 
			
		|||
      '#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 @@ class TermFieldMultipleVocabularyTest extends TaxonomyTestBase {
 | 
			
		|||
    $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 @@ class TermFieldMultipleVocabularyTest extends TaxonomyTestBase {
 | 
			
		|||
    $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 @@ class TermFieldTest extends TaxonomyTestBase {
 | 
			
		|||
    $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 @@ class TextFieldTest extends StringFieldTest {
 | 
			
		|||
    $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 @@ class TextFieldTest extends StringFieldTest {
 | 
			
		|||
    $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 @@ class UpdateContribTest extends UpdateTestBase {
 | 
			
		|||
    // 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 @@ class UserBlocksTest extends WebTestBase {
 | 
			
		|||
    // 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 @@ class DisplayTest extends PluginTestBase {
 | 
			
		|||
    $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 @@ class DisplayTest extends PluginTestBase {
 | 
			
		|||
    // 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 @@ class DisplayTest extends PluginTestBase {
 | 
			
		|||
    $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 @@ class DisplayTest extends PluginTestBase {
 | 
			
		|||
    $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 when view has more records.');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,7 @@ class ExposedFormTest extends ViewTestBase {
 | 
			
		|||
    $this->executeView($view);
 | 
			
		||||
    $exposed_form = $view->display_handler->getPlugin('exposed_form');
 | 
			
		||||
    $output = $exposed_form->renderExposedForm();
 | 
			
		||||
    $this->drupalSetContent(drupal_render($output));
 | 
			
		||||
    $this->setRawContent(drupal_render($output));
 | 
			
		||||
 | 
			
		||||
    $this->assertFieldByXpath('//form/@id', $this->getExpectedExposedFormId($view), 'Expected form ID found.');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ class StyleGridTest extends PluginTestBase {
 | 
			
		|||
    $this->executeView($view);
 | 
			
		||||
    $output = $view->preview();
 | 
			
		||||
    $output = drupal_render($output);
 | 
			
		||||
    $this->drupalSetContent($output);
 | 
			
		||||
    $this->setRawContent($output);
 | 
			
		||||
    if (!in_array($alignment, $this->alignmentsTested)) {
 | 
			
		||||
      $result = $this->xpath('//div[contains(@class, "views-view-grid") and contains(@class, :alignment) and contains(@class, :columns)]', array(':alignment' => $alignment, ':columns' => 'cols-' . $columns));
 | 
			
		||||
      $this->assertTrue(count($result), ucfirst($alignment) . " grid markup detected.");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ class ViewAjaxTest extends ViewTestBase {
 | 
			
		|||
    $this->assertEqual($data[1]['command'], 'insert');
 | 
			
		||||
    $this->assertTrue(strpos($data[1]['selector'], '.view-dom-id-') === 0);
 | 
			
		||||
 | 
			
		||||
    $this->drupalSetContent($data[1]['data']);
 | 
			
		||||
    $this->setRawContent($data[1]['data']);
 | 
			
		||||
    $result = $this->xpath('//div[contains(@class, "views-row")]');
 | 
			
		||||
    $this->assertEqual(count($result), 2, 'Ensure that two items are renderd in the HTML.');
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ class ViewElementTest extends ViewTestBase {
 | 
			
		|||
 | 
			
		||||
    // Set the content as our rendered array.
 | 
			
		||||
    $render = $this->render;
 | 
			
		||||
    $this->drupalSetContent(drupal_render($render));
 | 
			
		||||
    $this->setRawContent(drupal_render($render));
 | 
			
		||||
 | 
			
		||||
    $xpath = $this->xpath('//div[@class="views-element-container"]');
 | 
			
		||||
    $this->assertTrue($xpath, 'The view container has been found in the rendered output.');
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ class ViewElementTest extends ViewTestBase {
 | 
			
		|||
 | 
			
		||||
    // Test the render array again.
 | 
			
		||||
    $render = $this->render;
 | 
			
		||||
    $this->drupalSetContent(drupal_render($render));
 | 
			
		||||
    $this->setRawContent(drupal_render($render));
 | 
			
		||||
    // There should be 1 row in the results, 'John' arg 25.
 | 
			
		||||
    $xpath = $this->xpath('//div[@class="view-content"]/div');
 | 
			
		||||
    $this->assertEqual(count($xpath), 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ class ViewElementTest extends ViewTestBase {
 | 
			
		|||
    // Set the content as our rendered array.
 | 
			
		||||
    $render = $this->render;
 | 
			
		||||
    $render['#embed'] = TRUE;
 | 
			
		||||
    $this->drupalSetContent(drupal_render($render));
 | 
			
		||||
    $this->setRawContent(drupal_render($render));
 | 
			
		||||
 | 
			
		||||
    $xpath = $this->xpath('//div[@class="views-element-container"]');
 | 
			
		||||
    $this->assertTrue($xpath, 'The view container has been found in the rendered output.');
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ class ViewElementTest extends ViewTestBase {
 | 
			
		|||
    // Test the render array again.
 | 
			
		||||
    $render = $this->render;
 | 
			
		||||
    $render['#embed'] = TRUE;
 | 
			
		||||
    $this->drupalSetContent(drupal_render($render));
 | 
			
		||||
    $this->setRawContent(drupal_render($render));
 | 
			
		||||
    // There should be 1 row in the results, 'John' arg 25.
 | 
			
		||||
    $xpath = $this->xpath('//div[@class="view-content"]/div');
 | 
			
		||||
    $this->assertEqual(count($xpath), 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ class ItemsPerPageTest extends WizardTestBase {
 | 
			
		|||
    // appear in the expected order.
 | 
			
		||||
    $this->assertUrl($view['page[path]']);
 | 
			
		||||
    $this->assertText($view['page[title]']);
 | 
			
		||||
    $content = $this->drupalGetContent();
 | 
			
		||||
    $content = $this->getRawContent();
 | 
			
		||||
    $this->assertText($node5->label());
 | 
			
		||||
    $this->assertText($node4->label());
 | 
			
		||||
    $this->assertText($node3->label());
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ class ItemsPerPageTest extends WizardTestBase {
 | 
			
		|||
    $this->drupalPlaceBlock("views_block:{$view['id']}-block_1");
 | 
			
		||||
 | 
			
		||||
    $this->drupalGet('user');
 | 
			
		||||
    $content = $this->drupalGetContent();
 | 
			
		||||
    $content = $this->getRawContent();
 | 
			
		||||
    $this->assertText($node5->label());
 | 
			
		||||
    $this->assertText($node4->label());
 | 
			
		||||
    $this->assertText($node3->label());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ class SortingTest extends WizardTestBase {
 | 
			
		|||
    // Make sure the view shows the nodes in the expected order.
 | 
			
		||||
    $this->assertUrl($view1['page[path]']);
 | 
			
		||||
    $this->assertText($view1['page[title]']);
 | 
			
		||||
    $content = $this->drupalGetContent();
 | 
			
		||||
    $content = $this->getRawContent();
 | 
			
		||||
    $this->assertText($node1->label());
 | 
			
		||||
    $this->assertText($node2->label());
 | 
			
		||||
    $this->assertText($node3->label());
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ class SortingTest extends WizardTestBase {
 | 
			
		|||
    // Make sure the view shows the nodes in the expected order.
 | 
			
		||||
    $this->assertUrl($view2['page[path]']);
 | 
			
		||||
    $this->assertText($view2['page[title]']);
 | 
			
		||||
    $content = $this->drupalGetContent();
 | 
			
		||||
    $content = $this->getRawContent();
 | 
			
		||||
    $this->assertText($node3->label());
 | 
			
		||||
    $this->assertText($node2->label());
 | 
			
		||||
    $this->assertText($node1->label());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue