link.validate.test 20.4 KB
Newer Older
1
2
3
4
5
6
7
<?php

/**
 * @file
 * Tests that exercise the validation functions in the link module.
 */

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

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

24
25
  /**
   * Takes a url, and sees if it can validate that the url is valid.
26
27
   *
   * @codingStandardsIgnoreStart
28
   */
29
  protected function link_test_validate_url($url) {
30
    // @codingStandardsIgnoreEnd
31

32
    $field_name = $this->createLinkField();
33

34
    $label = $this->randomName();
35
    $settings = array(
36
      'title' => $label,
37
      $field_name => array(
38
        LANGUAGE_NONE => array(
39
40
41
          array(
            'title' => $label,
            'url' => $url,
42
          ),
43
44
        ),
      ),
45
    );
46

47
    $node = $this->drupalCreateNode($settings);
48

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

51
    $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
52
53
  }

54
}
55

56
57
58
/**
 * Class for Validate Test.
 */
59
class LinkValidateTest extends LinkValidateTestCase {
60

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

72
73
74
75
76
77
78
  /**
   * Validate basic URL.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_validate_basic_url() {
    // @codingStandardsIgnoreEnd
79
80
    $this->link_test_validate_url('http://www.example.com');
  }
81

82
83
  /**
   * Test if we're stopped from posting a bad url on default validation.
84
85
   *
   * @codingStandardsIgnoreStart
86
   */
87
88
  public function test_link_validate_bad_url_validate_default() {
    // @codingStandardsIgnoreEnd
89
90
    $this->web_user = $this->drupalCreateUser(array(
      'administer content types',
91
92
93
94
95
96
97
      'administer fields',
      'administer nodes',
      'administer filters',
      'access content',
      'create page content',
      'access administration pages',
    ));
98
    $this->drupalLogin($this->web_user);
99

100
    // Create field.
101
102
103
104
105
106
107
108
109
110
    $name = strtolower($this->randomName());
    $edit = array(
      'fields[_add_new_field][label]' => $name,
      'fields[_add_new_field][field_name]' => $name,
      'fields[_add_new_field][type]' => 'link_field',
      'fields[_add_new_field][widget_type]' => 'link_field',
    );
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
    $this->drupalPost(NULL, array(), t('Save field settings'));
    $this->drupalPost(NULL, array(), t('Save settings'));
111

112
113
114
115
    // Is field created?
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
    node_types_rebuild();
    menu_rebuild();
116

117
    // Create page form.
118
119
    $this->drupalGet('node/add/page');
    $field_name = 'field_' . $name;
120
121
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
122

123
124
    $edit = array(
      'title' => 'Simple Title',
125
      $field_name . '[und][0][url]' => 'edik:naw',
126
    );
127

128
    $this->drupalPost(NULL, $edit, t('Save'));
129
130
131
132
    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
      '@value' => 'edik:naw',
      '@field' => $name,
    )));
133
  }
134

135
136
  /**
   * Test if we're stopped from posting a bad url with validation on.
137
138
   *
   * @codingStandardsIgnoreStart
139
   */
140
141
  public function test_link_validate_bad_url_validate_on() {
    // @codingStandardsIgnoreEnd
142
143
    $this->web_user = $this->drupalCreateUser(array(
      'administer content types',
144
145
146
147
148
149
150
      'administer fields',
      'administer nodes',
      'administer filters',
      'access content',
      'create page content',
      'access administration pages',
    ));
151
    $this->drupalLogin($this->web_user);
152

153
    // Create field.
154
155
156
157
158
159
160
161
162
163
    $name = strtolower($this->randomName());
    $edit = array(
      'fields[_add_new_field][label]' => $name,
      'fields[_add_new_field][field_name]' => $name,
      'fields[_add_new_field][type]' => 'link_field',
      'fields[_add_new_field][widget_type]' => 'link_field',
    );
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
    $this->drupalPost(NULL, array(), t('Save field settings'));
    $this->drupalPost(NULL, array('instance[settings][validate_url]' => TRUE), t('Save settings'));
164

165
166
167
168
    // Is field created?
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
    node_types_rebuild();
    menu_rebuild();
169

170
    // Create page form.
171
172
    $this->drupalGet('node/add/page');
    $field_name = 'field_' . $name;
173
174
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
175

176
177
    $edit = array(
      'title' => 'Simple Title',
178
      $field_name . '[und][0][url]' => 'edik:naw',
179
    );
180

181
    $this->drupalPost(NULL, $edit, t('Save'));
182
183
184
185
    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
      '@field' => $name,
      '@value' => 'edik:naw',
    )));
186

187
  }
188

189
190
  /**
   * Test if we can post a bad url if the validation is expressly turned off.
191
192
   *
   * @codingStandardsIgnoreStart
193
   */
194
195
  public function test_link_validate_bad_url_validate_off() {
    // @codingStandardsIgnoreEnd
196
197
    $this->web_user = $this->drupalCreateUser(array(
      'administer content types',
198
199
200
201
202
203
204
      'administer fields',
      'administer nodes',
      'administer filters',
      'access content',
      'create page content',
      'access administration pages',
    ));
205
    $this->drupalLogin($this->web_user);
206

207
    // Create field.
208
209
210
211
212
213
214
215
216
217
    $name = strtolower($this->randomName());
    $edit = array(
      'fields[_add_new_field][label]' => $name,
      'fields[_add_new_field][field_name]' => $name,
      'fields[_add_new_field][type]' => 'link_field',
      'fields[_add_new_field][widget_type]' => 'link_field',
    );
    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
    $this->drupalPost(NULL, array(), t('Save field settings'));
    $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save settings'));
218

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

224
225
226
227
    // Is field created?
    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
    node_types_rebuild();
    menu_rebuild();
228

229
    // Create page form.
230
231
    $this->drupalGet('node/add/page');
    $field_name = 'field_' . $name;
232
233
    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
234

235
236
    $edit = array(
      'title' => 'Simple Title',
237
      $field_name . '[und][0][url]' => 'edik:naw',
238
    );
239

240
    $this->drupalPost(NULL, $edit, t('Save'));
241
242
243
244
    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
      '%field' => $name,
      '%value' => 'edik:naw',
    )));
245
  }
246

247
  /**
248
249
250
251
252
253
   * Validate switching between validation status.
   *
   * Test if a bad url can sneak through un-filtered if we play with the
   * validation...
   *
   * @codingStandardsIgnoreStart
254
   */
255
256
  public function x_test_link_validate_switching_between_validation_status() {
    // @codingStandardsIgnoreEnd
257
    $this->acquireContentTypes(1);
258
259
    $this->web_user = $this->drupalCreateUser(array(
      'administer content types',
260
261
262
263
264
265
266
      'administer fields',
      'administer nodes',
      'access administration pages',
      'access content',
      'create ' . $this->content_types[0]->type . ' content',
      'edit any ' . $this->content_types[0]->type . ' content',
    ));
267
    $this->drupalLogin($this->web_user);
268
269
270
271
    variable_set('node_options_' . $this->content_types[0]->name, array(
      'status',
      'promote',
    ));
272
273
274
275
    $field_settings = array(
      'type' => 'link',
      'widget_type' => 'link',
      'type_name' => $this->content_types[0]->name,
276
      // <-- This is needed or we have an error.
277
      'attributes' => array(),
278
279
280
281
282
283
      'validate_url' => 0,
    );

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

    $this->acquireNodes(2);
284

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

287
288
289
    $edit = array();
    $title = $this->randomName();
    $url = 'javascript:alert("http://example.com/' . $this->randomName() . '")';
290
291
    $edit[$field['field_name'] . '[0][url]'] = $url;
    $edit[$field['field_name'] . '[0][title]'] = $title;
292

293
    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
294
    // $this->pass($this->content);.
295
    // @codingStandardsIgnoreLine
296
    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
297
      // @codingStandardsIgnoreLine
298
299
300
      '%field' => $name,
      '%value' => trim($url),
    )));
301

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

306
    $this->drupalGet('node/' . $node->nid);
307
    $this->assertNoRaw($url, 'Make sure Javascript does not display.');
308

309
310
311
    // Turn the array validation back _on_.
    $edit = array('validate_url' => TRUE);
    $node_type_link = str_replace('_', '-', $node->type);
312
313
314
    // @codingStandardsIgnoreLine
    // $this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']);
    // $this->fail($this->content);.
315
    $this->drupalPost('admin/content/node-type/' . $node_type_link . '/fields/' . $field['field_name'], $edit, t('Save field settings'));
316

317
    $this->drupalGet('node/' . $node->nid);
318
319
320
321
    // This actually works because the display_url goes through the core
    // url() function.  But we should have a test that makes sure it continues
    // to work.
    $this->assertNoRaw($url, 'Make sure Javascript does not display.');
322
    // $this->fail($this->content);.
323
  }
324

325
326
327
328
329
330
331
  /**
   * Validate that '<front>' is a valid url.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_front_url() {
    // @codingStandardsIgnoreEnd
332
333
    $this->link_test_validate_url('<front>');
  }
334

335
336
337
338
339
340
341
  /**
   * Validate that an internal url would be accepted.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_internal_url() {
    // @codingStandardsIgnoreEnd
342
343
344
345
346
347
348
    // Create the content first.
    $node = $this->drupalCreateNode();

    $link = 'node/' . $node->nid;
    $this->link_test_validate_url($link);
    $type = link_url_type($link);
    $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
349
  }
350

351
352
353
354
355
356
357
  /**
   * Validate a simple mailto.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_mailto() {
    // @codingStandardsIgnoreEnd
358
359
360
    $this->link_test_validate_url('mailto:jcfiala@gmail.com');
  }

361
362
363
364
365
366
367
  /**
   * Check link external https.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_external_https() {
    // @codingStandardsIgnoreEnd
368
369
    $this->link_test_validate_url('https://www.example.com/');
  }
370

371
372
373
374
375
376
377
  /**
   * Check link FTP.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_ftp() {
    // @codingStandardsIgnoreEnd
378
379
380
    $this->link_test_validate_url('ftp://www.example.com/');
  }

381
}
382

383
384
385
/**
 * Validate Test News.
 */
386
class LinkValidateTestNews extends LinkValidateTestCase {
387

388
389
390
  /**
   * Get Info.
   */
391
  public static function getInfo() {
392
    return array(
393
394
395
      'name' => 'Link News Validation Tests',
      'description' => 'Tests the field validation for usenet urls.',
      'group' => 'Link',
396
397
    );
  }
398

399
400
401
402
403
404
405
  /**
   * Validate a news link to a message group.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_link_news() {
    // @codingStandardsIgnoreEnd
406
407
    $this->link_test_validate_url('news:comp.infosystems.www.misc');
  }
408

409
410
411
  /**
   * Validate a news link to a message id.  Said ID copied off of google groups.
   *
412
   * @codingStandardsIgnoreStart
413
414
415
   */
  public function test_link_news_message() {
    // @codingStandardsIgnoreEnd
416
417
418
    $this->link_test_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
  }

419
}
420

421
422
423
/**
 * Validate Specific URL.
 */
424
class LinkValidateSpecificURL extends LinkValidateTestCase {
425
426
427
428

  /**
   * Get Info.
   */
429
  public static function getInfo() {
430
    return array(
431
432
433
      'name' => 'Link Specific URL Validation Tests',
      'description' => 'Tests field validation with unusual urls',
      'group' => 'Link',
434
435
    );
  }
436

437
438
439
440
441
442
443
  /**
   * Lets throw in a lot of umlouts for testing!
   *
   * @codingStandardsIgnoreStart
   */
  public function test_umlout_url() {
    // @codingStandardsIgnoreEnd
444
445
    $this->link_test_validate_url('http://üÜü.exämple.com/nöde');
  }
446

447
448
449
450
451
452
453
  /**
   * Check umlout mailto.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_umlout_mailto() {
    // @codingStandardsIgnoreEnd
454
455
    $this->link_test_validate_url('mailto:Üser@exÅmple.com');
  }
456

457
458
459
460
461
462
463
  /**
   * Check german b in url.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_german_b_url() {
    // @codingStandardsIgnoreEnd
464
465
    $this->link_test_validate_url('http://www.test.com/ßstuff');
  }
466

467
468
469
470
471
472
473
  /**
   * Check Special in url.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_special_n_url() {
    // @codingStandardsIgnoreEnd
474
475
    $this->link_test_validate_url('http://www.testÑñ.com/');
  }
476

477
478
479
480
481
482
483
  /**
   * Curly Brackets in query.
   *
   * @codingStandardsIgnoreStart
   */
  public function test_curly_brackets_in_query() {
    // @codingStandardsIgnoreEnd
484
485
    $this->link_test_validate_url('http://www.healthyteennetwork.org/index.asp?Type=B_PR&SEC={2AE1D600-4FC6-4B4D-8822-F1D5F072ED7B}&DE={235FD1E7-208D-4363-9854-4E6775EB8A4C}');
  }
486

487
488
489
  /**
   * Here, we're testing that a very long url is stored properly in the db.
   *
490
   * Basically, trying to test http://drupal.org/node/376818
491
   *
492
   * @codingStandardsIgnoreStart
493
   */
494
495
  public function testLinkURLFieldIsBig() {
    // @codingStandardsIgnoreEnd
496
497
498
    $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';
    $this->link_test_validate_url($long_url);
  }
499

500
501
502
}

/**
503
504
505
506
 * Validate Url Light.
 *
 * A series of tests of links, only going against the link_validate_url function
 * in link.module.
507
508
509
510
 *
 * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 !
 */
class LinkValidateUrlLight extends DrupalWebTestCase {
511

512
513
514
  /**
   * Get Info.
   */
515
  public static function getInfo() {
516
    return array(
517
518
519
      'name' => 'Link Light Validation Tests',
      'description' => 'Tests the link_validate_url() function by itself, without invoking the full drupal/cck lifecycle.',
      'group' => 'Link',
520
521
    );
  }
522
523
524
525
526

  /**
   * Setup.
   */
  public function setUp() {
527
528
    parent::setUp('link');
  }
529

530
  /**
531
532
533
534
535
536
   * Name Link Type.
   *
   * Translates the LINK type constants to english for display and debugging of
   * tests.
   *
   * @codingStandardsIgnoreStart
537
   */
538
539
  public function name_Link_Type($type) {
    // @codingStandardsIgnoreEnd
540
541
542
    switch ($type) {
      case LINK_FRONT:
        return "Front";
543

544
545
      case LINK_EMAIL:
        return "Email";
546

547
548
      case LINK_NEWS:
        return "Newsgroup";
549

550
551
      case LINK_INTERNAL:
        return "Internal Link";
552

553
554
      case LINK_EXTERNAL:
        return "External Link";
555

556
557
      case FALSE:
        return "Invalid Link";
558

559
      default:
560
        return "Bad Value:" . $type;
561
562
    }
  }
563

564
565
566
567
  /**
   * Make sure that a link labeled <front> works.
   */
  public function testValidateFrontLink() {
568
    $valid = link_validate_url('<front>');
569
    $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified');
570
  }
571

572
573
574
575
  /**
   * Validate Email Link.
   */
  public function testValidateEmailLink() {
576
577
578
    $valid = link_validate_url('mailto:bob@example.com');
    $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified");
  }
579

580
581
582
583
  /**
   * Validate Email Link Bad.
   */
  public function testValidateEmailLinkBad() {
584
585
586
    $valid = link_validate_url(':bob@example.com');
    $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed');
  }
587

588
589
590
591
  /**
   * Validate Newsgroup Link.
   */
  public function testValidateNewsgroupLink() {
592
593
594
    $valid = link_validate_url('news:comp.infosystems.www.misc');
    $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.');
  }
595

596
597
598
599
  /**
   * Validate News Article Link.
   */
  public function testValidateNewsArticleLink() {
600
    $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
601
    $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.');
602
  }
603

604
605
606
607
  /**
   * Validate Bad Newsgroup Link.
   */
  public function testValidateBadNewsgroupLink() {
608
609
610
    $valid = link_validate_url('news:comp.bad_name.misc');
    $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.');
  }
611

612
613
614
615
  /**
   * Validate Internal Links.
   */
  public function testValidateInternalLinks() {
616
    $tempfile = drupal_tempnam('public://files', 'test');
617
618
    $links = array(
      'rss.xml',
619
620
      file_uri_target($tempfile),
      drupal_realpath($tempfile),
621
    );
622

623
    foreach ($links as $link) {
624
625
      $type = link_url_type($link);
      $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
626
      $valid = link_validate_url($link);
627
      $this->assertTrue($valid, 'Test ' . $link . ' is valid internal link.');
628
    }
629
  }
630

631
632
633
634
  /**
   * Validate External Links.
   */
  public function testValidateExternalLinks() {
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
    $links = array(
      'http://localhost:8080/',
      'www.example.com',
      'www.example.com/',
      'http://username:p%40ssw0rd!@www.example.com/',
      'http://@www.example.com/',
      'http://username:@www.example.com/',
      'http://username:password@www.example.com:8080/',
      'http://127.0.0.1:80/',
      'http://127.173.24.255:4723/',
      '127.173.24.255:4723/',
      'http://255.255.255.255:4823/',
      'www.test-site.com',
      'http://example.com/index.php?q=node/123',
      'http://example.com/?first_name=Joe Bob&last_name=Smith',
650
      // Anchors.
651
652
653
654
655
656
657
      'http://www.example.com/index.php#test',
      'http://www.example.com/index.php#this@that.',
      'http://www.example.com/index.php#',
      'http://www.cnn.com/video/#/video/politics/2008/12/09/intv.madeleine.albright.cnn',
      'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
      'http://www.example.com/blah/#this@that?',
    );
658

659
    // Test all of the protocols.
660
661
662
663
664
665
666
667
668
669
670
671
672
673
    $allowed_protocols = variable_get('filter_allowed_protocols', array(
      'http',
      'https',
      'ftp',
      'news',
      'nntp',
      'telnet',
      'mailto',
      'irc',
      'ssh',
      'sftp',
      'webcal',
    ));

674
675
    foreach ($allowed_protocols as $protocol) {
      if ($protocol !== 'news' && $protocol !== 'mailto') {
676
        $links[] = $protocol . '://www.example.com';
677
678
679
      }
    }
    foreach ($links as $link) {
680
681
      $type = link_url_type($link);
      $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.');
682
      $valid = link_validate_url($link);
683
      $this->assertTrue($valid, 'Test ' . $link . ' is valid external link.');
684
685
686
687
      // The following two lines are commented out and only used for
      // comparisons.
      // $valid2 = valid_url($link, TRUE);
      // $this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");.
688
689
    }
  }
690

691
692
693
694
  /**
   * Check Invalid External Links.
   */
  public function testInvalidExternalLinks() {
695
696
    $links = array(
      'http://www.ex ample.com/',
697
      // Bad ip!
698
      'http://25.0.0/',
699
      'http://4827.0.0.2/',
700
      // ß not allowed in domain names!
701
      'http://www.testß.com/',
702
      // Bad TLD.
703
704
705
      'http://.www.foo.bar./',
      // Domains can't have sections starting with a dash.
      // 'http://www.-fudge.com/',
706
707
      'http://example.com/index.php?page=this\that',
      'example@example.com',
708
709
710
    );
    foreach ($links as $link) {
      $valid = link_validate_url($link);
711
      $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
712
713
    }
  }
714

715
}