You are here

public function LinkSanitizeTest::testBlankTitleWithQuery in Link 7

Test that query URLs can be turned into absolute URLs.

File

tests/LinkSanitizeTest.test, line 130

Class

LinkSanitizeTest
Test for _link_sanitize().

Code

public function testBlankTitleWithQuery() {
  $item['title'] = '';
  $item['url'] = 'https://www.drupal.org/?page=42';
  list($field, $instance, $entity) = $this
    ->generateParams();

  // Disable the URL cutoff to confirm the URL.
  $instance['settings']['display']['url_cutoff'] = FALSE;
  _link_sanitize($item, NULL, $field, $instance, $entity);
  $this
    ->verbose('<pre>' . print_r($item, TRUE) . '</pre>');
  $this
    ->assertEqual('https://www.drupal.org/?page=42', $item['display_url']);
  $this
    ->assertEqual('https://www.drupal.org/', $item['url']);
  $this
    ->assertTrue(is_array($item['query']));
  $this
    ->assertEqual(array(
    'page' => 42,
  ), $item['query']);
  $this
    ->assertEqual(NULL, $item['fragment']);
}