Projet

Général

Profil

Paste
Télécharger (20,1 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / link / tests / link.validate.test @ 8e7483ab

1
<?php
2

    
3
/**
4
 * @file
5
 * Tests that exercise the validation functions in the link module.
6
 */
7

    
8
/**
9
 * Validate Test Case.
10
 */
11
class LinkValidateTestCase extends LinkBaseTestClass {
12

    
13
  /**
14
   * Create Link.
15
   */
16
  protected function createLink($url, $title, $attributes = array()) {
17
    return array(
18
      'url' => $url,
19
      'title' => $title,
20
      'attributes' => $attributes,
21
    );
22
  }
23

    
24
  /**
25
   * Takes a URL, sees if it can validate that the URL is valid.
26
   */
27
  protected function linkTestValidateUrl($url) {
28
    $field_name = $this->createLinkField();
29

    
30
    $label = $this->randomName();
31
    $settings = array(
32
      'title' => $label,
33
      $field_name => array(
34
        LANGUAGE_NONE => array(
35
          array(
36
            'title' => $label,
37
            'url' => $url,
38
          ),
39
        ),
40
      ),
41
    );
42

    
43
    $node = $this->drupalCreateNode($settings);
44

    
45
    $this->assertNotNull($node, ' has been created.', 'Node created');
46

    
47
    $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
48
  }
49

    
50
}
51

    
52
/**
53
 * Class for Validate Test.
54
 */
55
class LinkValidateTest extends LinkValidateTestCase {
56

    
57
  /**
58
   * Get Info.
59
   */
60
  public static function getInfo() {
61
    return array(
62
      'name' => 'Link Validation Tests',
63
      'description' => 'Tests the field validation.',
64
      'group' => 'Link',
65
    );
66
  }
67

    
68
  /**
69
   * Validate basic URL.
70
   */
71
  public function testLinkValidateBasicUrl() {
72
    $this->linkTestValidateUrl('http://www.example.com');
73
  }
74

    
75
  /**
76
   * Test if we're stopped from posting a bad url on default validation.
77
   */
78
  public function testLinkValidateBadUrlValidateDefault() {
79
    $this->web_user = $this->drupalCreateUser(array(
80
      'administer content types',
81
      'administer fields',
82
      'administer nodes',
83
      'administer filters',
84
      'access content',
85
      'create page content',
86
      'access administration pages',
87
    ));
88
    $this->drupalLogin($this->web_user);
89

    
90
    // Create field.
91
    $name = strtolower($this->randomName());
92
    $edit = array(
93
      'fields[_add_new_field][label]' => $name,
94
      'fields[_add_new_field][field_name]' => $name,
95
      'fields[_add_new_field][type]' => 'link_field',
96
      'fields[_add_new_field][widget_type]' => 'link_field',
97
    );
98
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
99
    $this->drupalPost(NULL, array(), t('Save field settings'));
100
    $this->drupalPost(NULL, array(), t('Save settings'));
101

    
102
    // Is field created?
103
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
104
    node_types_rebuild();
105
    menu_rebuild();
106

    
107
    // Create page form.
108
    $this->drupalGet('node/add/page');
109
    $field_name = 'field_' . $name;
110
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
111
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
112

    
113
    $edit = array(
114
      'title' => 'Simple Title',
115
      $field_name . '[und][0][url]' => 'edik:naw',
116
    );
117

    
118
    $this->drupalPost(NULL, $edit, t('Save'));
119
    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
120
      '@value' => 'edik:naw',
121
      '@field' => $name,
122
    )));
123
  }
124

    
125
  /**
126
   * Test if we're stopped from posting a bad url with validation on.
127
   */
128
  public function testLinkValidateBadUrlValidateOn() {
129
    $this->web_user = $this->drupalCreateUser(array(
130
      'administer content types',
131
      'administer fields',
132
      'administer nodes',
133
      'administer filters',
134
      'access content',
135
      'create page content',
136
      'access administration pages',
137
    ));
138
    $this->drupalLogin($this->web_user);
139

    
140
    // Create field.
141
    $name = strtolower($this->randomName());
142
    $edit = array(
143
      'fields[_add_new_field][label]' => $name,
144
      'fields[_add_new_field][field_name]' => $name,
145
      'fields[_add_new_field][type]' => 'link_field',
146
      'fields[_add_new_field][widget_type]' => 'link_field',
147
    );
148
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
149
    $this->drupalPost(NULL, array(), t('Save field settings'));
150
    $this->drupalPost(NULL, array('instance[settings][validate_url]' => TRUE), t('Save settings'));
151

    
152
    // Is field created?
153
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
154
    node_types_rebuild();
155
    menu_rebuild();
156

    
157
    // Create page form.
158
    $this->drupalGet('node/add/page');
159
    $field_name = 'field_' . $name;
160
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
161
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
162

    
163
    $edit = array(
164
      'title' => 'Simple Title',
165
      $field_name . '[und][0][url]' => 'edik:naw',
166
    );
167

    
168
    $this->drupalPost(NULL, $edit, t('Save'));
169
    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
170
      '@field' => $name,
171
      '@value' => 'edik:naw',
172
    )));
173

    
174
  }
175

    
176
  /**
177
   * Test if we can post a bad url if the validation is expressly turned off.
178
   */
179
  public function testLinkValidateBadUrlValidateOff() {
180
    $this->web_user = $this->drupalCreateUser(array(
181
      'administer content types',
182
      'administer fields',
183
      'administer nodes',
184
      'administer filters',
185
      'access content',
186
      'create page content',
187
      'access administration pages',
188
    ));
189
    $this->drupalLogin($this->web_user);
190

    
191
    // Create field.
192
    $name = strtolower($this->randomName());
193
    $edit = array(
194
      'fields[_add_new_field][label]' => $name,
195
      'fields[_add_new_field][field_name]' => $name,
196
      'fields[_add_new_field][type]' => 'link_field',
197
      'fields[_add_new_field][widget_type]' => 'link_field',
198
    );
199
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
200
    $this->drupalPost(NULL, array(), t('Save field settings'));
201
    $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save settings'));
202

    
203
    // @codingStandardsIgnoreLine
204
    /*$instance_details = db_query("SELECT * FROM {field_config_instance} WHERE field_name = :field_name AND bundle = 'page'", array(':field_name' => 'field_'. $name))->fetchObject();
205
    $this->fail('<pre>'. print_r($instance_details, TRUE) .'</pre>');
206
    $this->fail('<pre>'. print_r(unserialize($instance_details->data), TRUE) .'</pre>');*/
207

    
208
    // Is field created?
209
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
210
    node_types_rebuild();
211
    menu_rebuild();
212

    
213
    // Create page form.
214
    $this->drupalGet('node/add/page');
215
    $field_name = 'field_' . $name;
216
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
217
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
218

    
219
    $edit = array(
220
      'title' => 'Simple Title',
221
      $field_name . '[und][0][url]' => 'edik:naw',
222
    );
223

    
224
    $this->drupalPost(NULL, $edit, t('Save'));
225
    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
226
      '%field' => $name,
227
      '%value' => 'edik:naw',
228
    )));
229
  }
230

    
231
  /**
232
   * Validate switching between validation status.
233
   *
234
   * Test if a bad url can sneak through un-filtered if we play with the
235
   * validation...
236
   */
237
  public function xTestLinkValidateSwitchingBetweenValidationStatus() {
238
    $this->acquireContentTypes(1);
239
    $this->web_user = $this->drupalCreateUser(array(
240
      'administer content types',
241
      'administer fields',
242
      'administer nodes',
243
      'access administration pages',
244
      'access content',
245
      'create ' . $this->content_types[0]->type . ' content',
246
      'edit any ' . $this->content_types[0]->type . ' content',
247
    ));
248
    $this->drupalLogin($this->web_user);
249
    variable_set('node_options_' . $this->content_types[0]->name, array(
250
      'status',
251
      'promote',
252
    ));
253
    $field_settings = array(
254
      'type' => 'link',
255
      'widget_type' => 'link',
256
      'type_name' => $this->content_types[0]->name,
257
      // <-- This is needed or we have an error.
258
      'attributes' => array(),
259
      'validate_url' => 0,
260
    );
261

    
262
    $field = $this->createField($field_settings, 0);
263

    
264
    $this->acquireNodes(2);
265

    
266
    $this->drupalGet('node/' . $this->nodes[0]->nid);
267

    
268
    $edit = array();
269
    $title = $this->randomName();
270
    $url = 'javascript:alert("http://example.com/' . $this->randomName() . '")';
271
    $edit[$field['field_name'] . '[0][url]'] = $url;
272
    $edit[$field['field_name'] . '[0][title]'] = $title;
273

    
274
    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
275
    // $this->pass($this->content);.
276
    // @codingStandardsIgnoreLine
277
    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
278
      // @codingStandardsIgnoreLine
279
      '%field' => $name,
280
      '%value' => trim($url),
281
    )));
282

    
283
    // Make sure we get a new version!
284
    $node = node_load($this->nodes[0]->nid, NULL, TRUE);
285
    $this->assertEqual($url, $node->{$field['field_name']}[0]['url']);
286

    
287
    $this->drupalGet('node/' . $node->nid);
288
    $this->assertNoRaw($url, 'Make sure Javascript does not display.');
289

    
290
    // Turn the array validation back _on_.
291
    $edit = array('validate_url' => TRUE);
292
    $node_type_link = str_replace('_', '-', $node->type);
293
    // @codingStandardsIgnoreLine
294
    // $this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']);
295
    // $this->fail($this->content);.
296
    $this->drupalPost('admin/content/node-type/' . $node_type_link . '/fields/' . $field['field_name'], $edit, t('Save field settings'));
297

    
298
    $this->drupalGet('node/' . $node->nid);
299
    // This actually works because the display_url goes through the core
300
    // url() function.  But we should have a test that makes sure it continues
301
    // to work.
302
    $this->assertNoRaw($url, 'Make sure Javascript does not display.');
303
    // $this->fail($this->content);.
304
  }
305

    
306
  /**
307
   * Validate that '<front>' is a valid url.
308
   */
309
  public function testLinkFrontUrl() {
310
    $this->linkTestValidateUrl('<front>');
311
  }
312

    
313
  /**
314
   * Validate that an internal url would be accepted.
315
   */
316
  public function testLinkInternalUrl() {
317
    // Create the content first.
318
    $node = $this->drupalCreateNode();
319

    
320
    $link = 'node/' . $node->nid;
321
    $this->linkTestValidateUrl($link);
322
    $type = link_url_type($link);
323
    $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
324
  }
325

    
326
  /**
327
   * Validate a simple mailto.
328
   */
329
  public function testLinkMailto() {
330
    $this->linkTestValidateUrl('mailto:jcfiala@gmail.com');
331
  }
332

    
333
  /**
334
   * Check link external https.
335
   */
336
  public function testLinkExternalHttps() {
337
    $this->linkTestValidateUrl('https://www.example.com/');
338
  }
339

    
340
  /**
341
   * Check link FTP.
342
   */
343
  public function testLinkFtp() {
344
    $this->linkTestValidateUrl('ftp://www.example.com/');
345
  }
346

    
347
}
348

    
349
/**
350
 * Validate Test News.
351
 */
352
class LinkValidateTestNews extends LinkValidateTestCase {
353

    
354
  /**
355
   * Get Info.
356
   */
357
  public static function getInfo() {
358
    return array(
359
      'name' => 'Link News Validation Tests',
360
      'description' => 'Tests the field validation for usenet urls.',
361
      'group' => 'Link',
362
    );
363
  }
364

    
365
  /**
366
   * Validate a news link to a message group.
367
   */
368
  public function testLinkNews() {
369
    $this->linkTestValidateUrl('news:comp.infosystems.www.misc');
370
  }
371

    
372
  /**
373
   * Validate a news link to a message id.  Said ID copied off of google groups.
374
   */
375
  public function testLinkNewsMessage() {
376
    $this->linkTestValidateUrl('news:hj0db8$vrm$1@news.eternal-september.org');
377
  }
378

    
379
}
380

    
381
/**
382
 * Validate Specific URL.
383
 */
384
class LinkValidateSpecificURL extends LinkValidateTestCase {
385

    
386
  /**
387
   * Get Info.
388
   */
389
  public static function getInfo() {
390
    return array(
391
      'name' => 'Link Specific URL Validation Tests',
392
      'description' => 'Tests field validation with unusual urls',
393
      'group' => 'Link',
394
    );
395
  }
396

    
397
  /**
398
   * Lets throw in a lot of umlouts for testing!
399
   */
400
  public function testUmloutUrl() {
401
    $this->linkTestValidateUrl('http://üÜü.exämple.com/nöde');
402
  }
403

    
404
  /**
405
   * Check umlout mailto.
406
   */
407
  public function testUmloutMailto() {
408
    $this->linkTestValidateUrl('mailto:Üser@exÅmple.com');
409
  }
410

    
411
  /**
412
   * Check German b in URL, aka Eszett.
413
   */
414
  public function testGermanEszettUrl() {
415
    $this->linkTestValidateUrl('http://www.test.com/ßstuff');
416
  }
417

    
418
  /**
419
   * Check Spanish ñ in URL.
420
   */
421
  public function testSpecialEneUrl() {
422
    $this->linkTestValidateUrl('http://www.testÑñ.com/');
423
  }
424

    
425
  /**
426
   * Curly brackets in query.
427
   */
428
  public function testCurlyBracketsInQuery() {
429
    $this->linkTestValidateUrl('http://www.healthyteennetwork.org/index.asp?Type=B_PR&SEC={2AE1D600-4FC6-4B4D-8822-F1D5F072ED7B}&DE={235FD1E7-208D-4363-9854-4E6775EB8A4C}');
430
  }
431

    
432
  /**
433
   * Here, we're testing that a very long url is stored properly in the db.
434
   *
435
   * Basically, trying to test http://drupal.org/node/376818
436
   */
437
  public function testLinkUrlFieldIsBig() {
438
    $long_url = 'http://th.wikipedia.org/wiki/%E0%B9%82%E0%B8%A3%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%8D%E0%B8%88%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%B9%E0%B8%97%E0%B8%B4%E0%B8%A8_%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%A8%E0%B8%A3%E0%B8%B5%E0%B8%98%E0%B8%A3%E0%B8%A3%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A';
439
    $this->linkTestValidateUrl($long_url);
440
  }
441

    
442
}
443

    
444
/**
445
 * Validate Url Light.
446
 *
447
 * A series of tests of links, only going against the link_validate_url function
448
 * in link.module.
449
 *
450
 * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 !
451
 */
452
class LinkValidateUrlLight extends DrupalWebTestCase {
453

    
454
  /**
455
   * Get Info.
456
   */
457
  public static function getInfo() {
458
    return array(
459
      'name' => 'Link Light Validation Tests',
460
      'description' => 'Tests the link_validate_url() function by itself, without invoking the full drupal/cck lifecycle.',
461
      'group' => 'Link',
462
    );
463
  }
464

    
465
  /**
466
   * {@inheritdoc}
467
   */
468
  public function setUp(array $modules = array()) {
469
    $modules[] = 'link';
470
    parent::setUp($modules);
471
  }
472

    
473
  /**
474
   * Name Link Type.
475
   *
476
   * Translates the LINK type constants to english for display and debugging of
477
   * tests.
478
   *
479
   * @codingStandardsIgnoreStart
480
   */
481
  public function name_Link_Type($type) {
482
    // @codingStandardsIgnoreEnd
483
    switch ($type) {
484
      case LINK_FRONT:
485
        return "Front";
486

    
487
      case LINK_EMAIL:
488
        return "Email";
489

    
490
      case LINK_TEL:
491
        return "Telephone";
492

    
493
      case LINK_NEWS:
494
        return "Newsgroup";
495

    
496
      case LINK_INTERNAL:
497
        return "Internal Link";
498

    
499
      case LINK_EXTERNAL:
500
        return "External Link";
501

    
502
      case FALSE:
503
        return "Invalid Link";
504

    
505
      default:
506
        return "Bad Value:" . $type;
507
    }
508
  }
509

    
510
  /**
511
   * Make sure that a link labeled <front> works.
512
   */
513
  public function testValidateFrontLink() {
514
    $valid = link_validate_url('<front>');
515
    $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified');
516
  }
517

    
518
  /**
519
   * Validate Email Link.
520
   */
521
  public function testValidateEmailLink() {
522
    $valid = link_validate_url('mailto:bob@example.com');
523
    $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified");
524
  }
525

    
526
  /**
527
   * Validate Email Link Bad.
528
   */
529
  public function testValidateEmailLinkBad() {
530
    $valid = link_validate_url(':bob@example.com');
531
    $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed');
532
  }
533

    
534
  /**
535
   * Confirm that valid tel: links work as expected.
536
   */
537
  public function testValidateTelLinks() {
538
    $links = array(
539
      'tel:01',
540
      'tel:123456789012345',
541
      'tel:+123456789012345',
542
    );
543
    foreach ($links as $link) {
544
      $type = link_url_type($link);
545
      $this->assertEqual(LINK_TEL, $type, 'Test ' . $link . ' is a tel link.');
546
      $valid = link_validate_url($link);
547
      $this->assertTrue($valid, 'Test ' . $link . ' is valid tel link.');
548
    }
549
  }
550

    
551
  /**
552
   * Confirm that invalid tel: links work as expected.
553
   */
554
  public function testValidateTelLinksBad() {
555
    $links = array(
556
      'tel:0',
557
      'tel:1234567890123456',
558
      'tel:+1',
559
      'tel:+0123456789',
560
      'tel:+1234567890123456',
561
      ':12345678',
562
    );
563
    foreach ($links as $link) {
564
      $type = link_url_type($link);
565
      $this->assertFalse($type, 'Test ' . $link . ' is not a tel link.');
566
      $valid = link_validate_url($link);
567
      $this->assertFalse($valid, 'Test ' . $link . ' is not a valid tel link.');
568
    }
569
  }
570

    
571
  /**
572
   * Validate Newsgroup Link.
573
   */
574
  public function testValidateNewsgroupLink() {
575
    $valid = link_validate_url('news:comp.infosystems.www.misc');
576
    $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.');
577
  }
578

    
579
  /**
580
   * Validate News Article Link.
581
   */
582
  public function testValidateNewsArticleLink() {
583
    $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
584
    $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.');
585
  }
586

    
587
  /**
588
   * Validate Bad Newsgroup Link.
589
   */
590
  public function testValidateBadNewsgroupLink() {
591
    $valid = link_validate_url('news:comp.bad_name.misc');
592
    $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.');
593
  }
594

    
595
  /**
596
   * Validate Internal Links.
597
   */
598
  public function testValidateInternalLinks() {
599
    $tempfile = drupal_tempnam('public://files', 'test');
600
    $links = array(
601
      'rss.xml',
602
      'foo#bar',
603
      file_uri_target($tempfile),
604
      drupal_realpath($tempfile),
605
    );
606

    
607
    foreach ($links as $link) {
608
      $type = link_url_type($link);
609
      $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
610
      $valid = link_validate_url($link);
611
      $this->assertTrue($valid, 'Test ' . $link . ' is valid internal link.');
612
    }
613
  }
614

    
615
  /**
616
   * Validate External Links.
617
   */
618
  public function testValidateExternalLinks() {
619
    $links = array(
620
      'http://localhost:8080/',
621
      'www.example.com',
622
      'www.example.com/',
623
      'http://username:p%40ssw0rd!@www.example.com/',
624
      'http://@www.example.com/',
625
      'http://username:@www.example.com/',
626
      'http://username:password@www.example.com:8080/',
627
      'http://127.0.0.1:80/',
628
      'http://127.173.24.255:4723/',
629
      '127.173.24.255:4723/',
630
      'http://255.255.255.255:4823/',
631
      'www.test-site.com',
632
      'http://example.com/index.php?q=node/123',
633
      'http://example.com/?first_name=Joe Bob&last_name=Smith',
634
      // Anchors.
635
      'http://www.example.com/index.php#test',
636
      'http://www.example.com/index.php#this@that.',
637
      'http://www.example.com/index.php#',
638
      'http://www.cnn.com/video/#/video/politics/2008/12/09/intv.madeleine.albright.cnn',
639
      'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
640
      'http://www.example.com/blah/#this@that?',
641
    );
642

    
643
    // Test all of the protocols.
644
    $allowed_protocols = variable_get('filter_allowed_protocols', array(
645
      'http',
646
      'https',
647
      'ftp',
648
      'news',
649
      'nntp',
650
      'telnet',
651
      'mailto',
652
      'irc',
653
      'ssh',
654
      'sftp',
655
      'webcal',
656
    ));
657

    
658
    foreach ($allowed_protocols as $protocol) {
659
      if ($protocol !== 'news' && $protocol !== 'mailto') {
660
        $links[] = $protocol . '://www.example.com';
661
      }
662
    }
663
    foreach ($links as $link) {
664
      $type = link_url_type($link);
665
      $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.');
666
      $valid = link_validate_url($link);
667
      $this->assertTrue($valid, 'Test ' . $link . ' is valid external link.');
668
      // The following two lines are commented out and only used for
669
      // comparisons.
670
      // $valid2 = valid_url($link, TRUE);
671
      // $this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");.
672
    }
673
  }
674

    
675
  /**
676
   * Check Invalid External Links.
677
   */
678
  public function testInvalidExternalLinks() {
679
    $links = array(
680
      'http://www.ex ample.com/',
681
      // Bad ip!
682
      'http://25.0.0/',
683
      'http://4827.0.0.2/',
684
      // ß not allowed in domain names!
685
      'http://www.testß.com/',
686
      // Bad TLD.
687
      'http://.www.foo.bar./',
688
      // Domains can't have sections starting with a dash.
689
      // 'http://www.-fudge.com/',
690
      'http://example.com/index.php?page=this\that',
691
      'example@example.com',
692
    );
693
    foreach ($links as $link) {
694
      $valid = link_validate_url($link);
695
      $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
696
    }
697
  }
698

    
699
}