MenuTest.php 21.8 KB
Newer Older
1
2
<?php

3
4
/**
 * @file
5
 * Definition of Drupal\menu\Tests\MenuTest.
6
7
 */

8
9
namespace Drupal\menu\Tests;

10
11
use Drupal\simpletest\WebTestBase;

12
class MenuTest extends WebTestBase {
13
14
15
16
17
18

  /**
   * Modules to enable.
   *
   * @var array
   */
19
  public static $modules = array('menu', 'block', 'test_page_test');
20

21
22
23
24
25
  protected $big_user;
  protected $std_user;
  protected $menu;
  protected $items;

26
  public static function getInfo() {
27
    return array(
28
      'name' => 'Menu link creation/deletion',
29
      'description' => 'Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the menu module UI.',
30
      'group' => 'Menu'
31
32
33
34
    );
  }

  function setUp() {
35
36
    parent::setUp();

37
38
    $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));

39
    // Create users.
40
    $this->big_user = $this->drupalCreateUser(array('access administration pages', 'administer blocks', 'administer menu', 'create article content'));
41
42
43
44
    $this->std_user = $this->drupalCreateUser(array());
  }

  /**
45
   * Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.
46
47
48
49
50
51
   */
  function testMenu() {
    // Login the user.
    $this->drupalLogin($this->big_user);
    $this->items = array();

52
53
54
55
    $this->menu = $this->addCustomMenu();
    $this->doMenuTests($this->menu->id());
    $this->addInvalidMenuLink($this->menu->id());
    $this->addCustomMenuCRUD();
56
57
58
59

    // Do standard user tests.
    // Login the user.
    $this->drupalLogin($this->std_user);
60
    $this->verifyAccess(403, $this->menu->id());
61
62
    foreach ($this->items as $item) {
      $node = node_load(substr($item['link_path'], 5)); // Paths were set as 'node/$nid'.
63
      $this->verifyMenuLink($item, $node);
64
65
66
67
68
    }

    // Login the user.
    $this->drupalLogin($this->big_user);

69
    // Delete menu links.
70
    foreach ($this->items as $item) {
71
      $this->deleteMenuLink($item);
72
73
74
75
76
    }

    // Delete custom menu.
    $this->deleteCustomMenu($this->menu);

77
78
    // Modify and reset a standard menu link.
    $item = $this->getStandardMenuLink();
79
    $old_title = $item['link_title'];
80
    $this->modifyMenuLink($item);
81
    $item = entity_load('menu_link', $item['mlid']);
82
83
84
    // Verify that a change to the description is saved.
    $description = $this->randomName(16);
    $item['options']['attributes']['title']  = $description;
85
86
87
88
    $return_value = menu_link_save($item);
    // Save the menu link again to test the return value of the procedural save
    // helper.
    $this->assertIdentical($return_value, $item->save(), 'Return value of menu_link_save() is identical to the return value of $menu_link->save().');
89
    $saved_item = entity_load('menu_link', $item['mlid']);
90
    $this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
91
    $this->resetMenuLink($item, $old_title);
92
93
  }

94
95
96
97
98
  /**
   * Add custom menu using CRUD functions.
   */
  function addCustomMenuCRUD() {
    // Add a new custom menu.
99
    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
100
    $label = $this->randomName(16);
101

102
103
104
    $menu = entity_create('menu', array(
      'id' => $menu_name,
      'label' => $label,
105
      'description' => 'Description text',
106
107
    ));
    $menu->save();
108
109

    // Assert the new menu.
110
    $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
111
    $this->assertRaw($label, 'Custom menu was added.');
112
113

    // Edit the menu.
114
115
116
    $new_label = $this->randomName(16);
    $menu->set('label', $new_label);
    $menu->save();
117
    $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
118
    $this->assertRaw($new_label, 'Custom menu was edited.');
119
120
121
122
123
124
  }

  /**
   * Add custom menu.
   */
  function addCustomMenu() {
125
126

    // Try adding a menu using a menu_name that is too long.
127
    $this->drupalGet('admin/structure/menu/add');
128
    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1);
129
    $label = $this->randomName(16);
130
    $edit = array(
131
      'id' => $menu_name,
132
      'description' => '',
133
      'label' =>  $label,
134
    );
135
    $this->drupalPost('admin/structure/menu/add', $edit, t('Save'));
136
137

    // Verify that using a menu_name that is too long results in a validation message.
138
139
140
141
142
    $this->assertRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array(
      '!name' => t('Menu name'),
      '%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
      '%length' => drupal_strlen($menu_name),
    )));
143
144

    // Change the menu_name so it no longer exceeds the maximum length.
145
    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
146
    $edit['id'] = $menu_name;
147
    $this->drupalPost('admin/structure/menu/add', $edit, t('Save'));
148
149

    // Verify that no validation error is given for menu_name length.
150
151
152
153
154
    $this->assertNoRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array(
      '!name' => t('Menu name'),
      '%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
      '%length' => drupal_strlen($menu_name),
    )));
155
156
    // Verify that confirmation message displayed.
    $this->assertRaw(t('Menu %label has been added.', array('%label' => $label)));
157
    $this->drupalGet('admin/structure/menu');
158
    $this->assertText($label, 'Menu created');
159
160

    // Enable the custom menu block.
161
    $menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'.
162
    // Confirm that the custom menu block is available.
163
    $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add');
164
    $this->assertText($label);
165

166
167
    // Enable the block.
    $this->drupalPlaceBlock('menu_menu_block:' . $menu_name);
168
169
170
171
172
173
174
175
176
    return menu_load($menu_name);
  }

  /**
   * Delete custom menu.
   *
   * @param string $menu_name Custom menu name.
   */
  function deleteCustomMenu($menu) {
177
178
    $menu_name = $this->menu->id();
    $label = $this->menu->label();
179
180

    // Delete custom menu.
181
    $this->drupalPost("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
182
    $this->assertResponse(200);
183
    $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $label)), 'Custom menu was deleted');
184
    $this->assertFalse(menu_load($menu_name), 'Custom menu was deleted');
185
    // Test if all menu links associated to the menu were removed from database.
186
    $result = entity_load_multiple_by_properties('menu_link', array('menu_name' => $menu_name));
187
    $this->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
188
189
190
191
192
193
194
195

    // Make sure there's no delete button on system menus.
    $this->drupalGet('admin/structure/menu/manage/main/edit');
    $this->assertNoRaw('edit-delete', 'The delete button was not found');

    // Try to delete the main menu.
    $this->drupalGet('admin/structure/menu/manage/main/delete');
    $this->assertText(t('You are not authorized to access this page.'));
196
197
198
  }

  /**
199
   * Tests menu functionality.
200
   */
201
  function doMenuTests($menu_name) {
202
    // Add nodes to use as links for menu links.
203
204
    $node1 = $this->drupalCreateNode(array('type' => 'article'));
    $node2 = $this->drupalCreateNode(array('type' => 'article'));
205
206
207
    $node3 = $this->drupalCreateNode(array('type' => 'article'));
    $node4 = $this->drupalCreateNode(array('type' => 'article'));
    $node5 = $this->drupalCreateNode(array('type' => 'article'));
208

209
210
    // Add menu links.
    $item1 = $this->addMenuLink(0, 'node/' . $node1->nid, $menu_name);
211
    $item2 = $this->addMenuLink($item1['mlid'], 'node/' . $node2->nid, $menu_name, FALSE);
212
213
214
215
    $item3 = $this->addMenuLink($item2['mlid'], 'node/' . $node3->nid, $menu_name);
    $this->assertMenuLink($item1['mlid'], array('depth' => 1, 'has_children' => 1, 'p1' => $item1['mlid'], 'p2' => 0));
    $this->assertMenuLink($item2['mlid'], array('depth' => 2, 'has_children' => 1, 'p1' => $item1['mlid'], 'p2' => $item2['mlid'], 'p3' => 0));
    $this->assertMenuLink($item3['mlid'], array('depth' => 3, 'has_children' => 0, 'p1' => $item1['mlid'], 'p2' => $item2['mlid'], 'p3' => $item3['mlid'], 'p4' => 0));
216

217
218
219
    // Verify menu links.
    $this->verifyMenuLink($item1, $node1);
    $this->verifyMenuLink($item2, $node2, $item1, $node1);
220
221
222
223
224
225
226
    $this->verifyMenuLink($item3, $node3, $item2, $node2);

    // Add more menu links.
    $item4 = $this->addMenuLink(0, 'node/' . $node4->nid, $menu_name);
    $item5 = $this->addMenuLink($item4['mlid'], 'node/' . $node5->nid, $menu_name);
    $this->assertMenuLink($item4['mlid'], array('depth' => 1, 'has_children' => 1, 'p1' => $item4['mlid'], 'p2' => 0));
    $this->assertMenuLink($item5['mlid'], array('depth' => 2, 'has_children' => 0, 'p1' => $item4['mlid'], 'p2' => $item5['mlid'], 'p3' => 0));
227

228
229
230
    // Modify menu links.
    $this->modifyMenuLink($item1);
    $this->modifyMenuLink($item2);
231

232
233
234
    // Toggle menu links.
    $this->toggleMenuLink($item1);
    $this->toggleMenuLink($item2);
235

236
237
238
239
240
241
242
243
    // Move link and verify that descendants are updated.
    $this->moveMenuLink($item2, $item5['mlid'], $menu_name);
    $this->assertMenuLink($item1['mlid'], array('depth' => 1, 'has_children' => 0, 'p1' => $item1['mlid'], 'p2' => 0));
    $this->assertMenuLink($item4['mlid'], array('depth' => 1, 'has_children' => 1, 'p1' => $item4['mlid'], 'p2' => 0));
    $this->assertMenuLink($item5['mlid'], array('depth' => 2, 'has_children' => 1, 'p1' => $item4['mlid'], 'p2' => $item5['mlid'], 'p3' => 0));
    $this->assertMenuLink($item2['mlid'], array('depth' => 3, 'has_children' => 1, 'p1' => $item4['mlid'], 'p2' => $item5['mlid'], 'p3' => $item2['mlid'], 'p4' => 0));
    $this->assertMenuLink($item3['mlid'], array('depth' => 4, 'has_children' => 0, 'p1' => $item4['mlid'], 'p2' => $item5['mlid'], 'p3' => $item2['mlid'], 'p4' => $item3['mlid'], 'p5' => 0));

244
245
246
247
248
249
250
251
    // Add 102 menu links with increasing weights, then make sure the last-added
    // item's weight doesn't get changed because of the old hardcoded delta=50
    $items = array();
    for ($i = -50; $i <= 51; $i++) {
      $items[$i] = $this->addMenuLink(0, 'node/' . $node1->nid, $menu_name, TRUE, strval($i));
    }
    $this->assertMenuLink($items[51]['mlid'], array('weight' => '51'));

252
253
254
255
    // Enable a link via the overview form.
    $this->disableMenuLink($item1);
    $edit = array();

256
257
258
259
    // Note in the UI the 'links[mlid:x][hidden]' form element maps to enabled,
    // or NOT hidden.
    $edit['links[mlid:' . $item1['mlid'] . '][hidden]'] = TRUE;
    $this->drupalPost('admin/structure/menu/manage/' . $item1['menu_name'], $edit, t('Save'));
260
261

    // Verify in the database.
262
    $this->assertMenuLink($item1['mlid'], array('hidden' => 0));
263

264
    // Save menu links for later tests.
265
266
267
268
    $this->items[] = $item1;
    $this->items[] = $item2;
  }

269
270
271
272
273
274
275
  /**
   * Add and remove a menu link with a query string and fragment.
   */
  function testMenuQueryAndFragment() {
    $this->drupalLogin($this->big_user);

    // Make a path with query and fragment on.
276
    $path = 'test-page?arg1=value1&arg2=value2';
277
278
279
    $item = $this->addMenuLink(0, $path);

    $this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
280
    $this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
281
282

    // Now change the path to something without query and fragment.
283
    $path = 'test-page';
284
285
    $this->drupalPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array('link_path' => $path), t('Save'));
    $this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
286
    $this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
287
288
  }

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
  /**
   * Test renaming built-in menu.
   */
  function testSystemMenuRename() {
    $this->drupalLogin($this->big_user);
    $edit = array(
      'label' => $this->randomName(16),
    );
    $this->drupalPost('admin/structure/menu/manage/main/edit', $edit, t('Save'));

    // Make sure menu shows up with new name in block addition.
    $default_theme = variable_get('theme_default', 'stark');
    $this->drupalget('admin/structure/block/list/block_plugin_ui:' . $default_theme . '/add');
    $this->assertText($edit['label']);
  }

305
  /**
306
   * Add a menu link using the menu module UI.
307
308
309
310
   *
   * @param integer $plid Parent menu link id.
   * @param string $link Link path.
   * @param string $menu_name Menu name.
311
   * @param string $weight Menu weight
312
313
314
   *
   * @return \Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link
   *   A menu link entity.
315
   */
316
  function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'tools', $expanded = TRUE, $weight = '0') {
317
    // View add menu link page.
318
    $this->drupalGet("admin/structure/menu/manage/$menu_name/add");
319
320
    $this->assertResponse(200);

321
    $title = '!link_' . $this->randomName(16);
322
    $edit = array(
323
324
325
326
      'link_path' => $link,
      'link_title' => $title,
      'description' => '',
      'enabled' => TRUE, // Use this to disable the menu and test.
327
      'expanded' => $expanded, // Setting this to true should test whether it works when we do the std_user tests.
328
      'parent' =>  $menu_name . ':' . $plid,
329
      'weight' => $weight,
330
331
    );

332
    // Add menu link.
333
    $this->drupalPost(NULL, $edit, t('Save'));
334
    $this->assertResponse(200);
335
    $this->assertText('The menu link has been saved.');
336

337
338
339
340
    $menu_links = entity_load_multiple_by_properties('menu_link', array('link_title' => $title));
    $menu_link = reset($menu_links);
    $this->assertTrue('Menu link was found in database.');
    $this->assertMenuLink($menu_link->id(), array('menu_name' => $menu_name, 'link_path' => $link, 'has_children' => 0, 'plid' => $plid));
341

342
    return $menu_link;
343
344
345
  }

  /**
346
   * Attempt to add menu link with invalid path or no access permission.
347
348
349
   *
   * @param string $menu_name Menu name.
   */
350
  function addInvalidMenuLink($menu_name = 'tools') {
351
    foreach (array('-&-', 'admin/people/permissions', '#') as $link_path) {
352
      $edit = array(
353
354
        'link_path' => $link_path,
        'link_title' => 'title',
355
      );
356
      $this->drupalPost("admin/structure/menu/manage/$menu_name/add", $edit, t('Save'));
357
      $this->assertRaw(t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $link_path)), 'Menu link was not created');
358
359
360
361
    }
  }

  /**
362
   * Verify a menu link using the menu module UI.
363
   *
364
365
366
367
   * @param array $item Menu link.
   * @param object $item_node Menu link content node.
   * @param array $parent Parent menu link.
   * @param object $parent_node Parent menu link content node.
368
   */
369
  function verifyMenuLink($item, $item_node, $parent = NULL, $parent_node = NULL) {
370
371
372
373
    // View home page.
    $this->drupalGet('');
    $this->assertResponse(200);

374
    // Verify parent menu link.
375
    if (isset($parent)) {
376
      // Verify menu link.
377
      $title = $parent['link_title'];
378
      $this->assertLink($title, 0, 'Parent menu link was displayed');
379

380
      // Verify menu link link.
381
      $this->clickLink($title);
382
      $title = $parent_node->label();
383
      $this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Parent menu link link target was correct');
384
385
    }

386
    // Verify menu link.
387
    $title = $item['link_title'];
388
    $this->assertLink($title, 0, 'Menu link was displayed');
389

390
    // Verify menu link link.
391
    $this->clickLink($title);
392
    $title = $item_node->label();
393
    $this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Menu link link target was correct');
394
395
  }

396
397
398
399
400
401
402
403
404
405
406
407
408
  /**
   * Change the parent of a menu link using the menu module UI.
   */
  function moveMenuLink($item, $plid, $menu_name) {
    $mlid = $item['mlid'];

    $edit = array(
      'parent' => $menu_name . ':' . $plid,
    );
    $this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
    $this->assertResponse(200);
  }

409
  /**
410
   * Modify a menu link using the menu module UI.
411
   *
412
   * @param array $item Menu link passed by reference.
413
   */
414
  function modifyMenuLink(&$item) {
415
416
417
418
419
    $item['link_title'] = $this->randomName(16);

    $mlid = $item['mlid'];
    $title = $item['link_title'];

420
    // Edit menu link.
421
    $edit = array();
422
    $edit['link_title'] = $title;
423
    $this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
424
    $this->assertResponse(200);
425
    $this->assertText('The menu link has been saved.');
426
    // Verify menu link.
427
    $this->drupalGet('admin/structure/menu/manage/' . $item['menu_name']);
428
    $this->assertText($title, 'Menu link was edited');
429
430
431
  }

  /**
432
   * Reset a standard menu link using the menu module UI.
433
   *
434
435
   * @param array $item Menu link.
   * @param string $old_title Original title for menu link.
436
   */
437
  function resetMenuLink($item, $old_title) {
438
439
440
    $mlid = $item['mlid'];
    $title = $item['link_title'];

441
    // Reset menu link.
442
    $this->drupalPost("admin/structure/menu/item/$mlid/reset", array(), t('Reset'));
443
    $this->assertResponse(200);
444
    $this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');
445

446
    // Verify menu link.
447
    $this->drupalGet('');
448
449
    $this->assertNoText($title, 'Menu link was reset');
    $this->assertText($old_title, 'Menu link was reset');
450
451
452
  }

  /**
453
   * Delete a menu link using the menu module UI.
454
   *
455
   * @param array $item Menu link.
456
   */
457
  function deleteMenuLink($item) {
458
459
460
    $mlid = $item['mlid'];
    $title = $item['link_title'];

461
    // Delete menu link.
462
    $this->drupalPost("admin/structure/menu/item/$mlid/delete", array(), t('Confirm'));
463
    $this->assertResponse(200);
464
    $this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), 'Menu link was deleted');
465
466
467

    // Verify deletion.
    $this->drupalGet('');
468
    $this->assertNoText($title, 'Menu link was deleted');
469
470
471
  }

  /**
472
   * Alternately disable and enable a menu link.
473
   *
474
475
   * @param $item
   *   Menu link.
476
   */
477
  function toggleMenuLink($item) {
478
    $this->disableMenuLink($item);
479

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
    // Verify menu link is absent.
    $this->drupalGet('');
    $this->assertNoText($item['link_title'], 'Menu link was not displayed');
    $this->enableMenuLink($item);

    // Verify menu link is displayed.
    $this->drupalGet('');
    $this->assertText($item['link_title'], 'Menu link was displayed');
  }

  /**
   * Disable a menu link.
   *
   * @param $item
   *   Menu link.
   */
  function disableMenuLink($item) {
    $mlid = $item['mlid'];
498
    $edit['enabled'] = FALSE;
499
    $this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
500

501
502
    // Unlike most other modules, there is no confirmation message displayed.
    // Verify in the database.
503
    $this->assertMenuLink($mlid, array('hidden' => 1));
504
  }
505

506
507
508
509
510
511
512
513
  /**
   * Enable a menu link.
   *
   * @param $item
   *   Menu link.
   */
  function enableMenuLink($item) {
    $mlid = $item['mlid'];
514
    $edit['enabled'] = TRUE;
515
    $this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
516

517
    // Verify in the database.
518
519
520
521
522
523
524
525
526
527
528
529
530
531
    $this->assertMenuLink($mlid, array('hidden' => 0));
  }

  /**
   * Fetch the menu item from the database and compare it to the specified
   * array.
   *
   * @param $mlid
   *   Menu item id.
   * @param $item
   *   Array containing properties to verify.
   */
  function assertMenuLink($mlid, array $expected_item) {
    // Retrieve menu link.
532
533
    $item = entity_load('menu_link', $mlid);
    $options = $item->options;
534
535
536
537
538
539
540
    if (!empty($options['query'])) {
      $item['link_path'] .= '?' . drupal_http_build_query($options['query']);
    }
    if (!empty($options['fragment'])) {
      $item['link_path'] .= '#' . $options['fragment'];
    }
    foreach ($expected_item as $key => $value) {
541
      $this->assertEqual($item[$key], $value, format_string('Parameter %key had expected value.', array('%key' => $key)));
542
    }
543
544
545
  }

  /**
546
   * Get standard menu link.
547
   */
548
  private function getStandardMenuLink() {
549
550
551
552
553
554
555
556
557
558
559
    $mlid = 0;
    // Retrieve menu link id of the Log out menu link, which will always be on
    // the front page.
    $query = entity_query('menu_link')
      ->condition('module', 'system')
      ->condition('router_path', 'user/logout');
    $result = $query->execute();
    if (!empty($result)) {
      $mlid = reset($result);
    }

560
    $this->assertTrue($mlid > 0, 'Standard menu link id was found');
561
    // Load menu link.
562
    // Use api function so that link is translated for rendering.
563
    $item = entity_load('menu_link', $mlid);
564
    $this->assertTrue((bool) $item, 'Standard menu link was loaded');
565
566
567
568
569
570
571
572
    return $item;
  }

  /**
   * Verify the logged in user has the desired access to the various menu nodes.
   *
   * @param integer $response HTTP response code.
   */
573
  private function verifyAccess($response = 200, $menu_name = 'tools') {
574
575
576
577
    // View menu help node.
    $this->drupalGet('admin/help/menu');
    $this->assertResponse($response);
    if ($response == 200) {
578
      $this->assertText(t('Menu'), 'Menu help was displayed');
579
580
581
    }

    // View menu build overview node.
582
    $this->drupalGet('admin/structure/menu');
583
584
    $this->assertResponse($response);
    if ($response == 200) {
585
      $this->assertText(t('Menus'), 'Menu build overview node was displayed');
586
587
    }

588
    // View tools menu customization node.
589
    $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
590
        $this->assertResponse($response);
591
    if ($response == 200) {
592
      $this->assertText(t('Tools'), 'Tools menu node was displayed');
593
594
595
    }

    // View menu edit node.
596
    $item = $this->getStandardMenuLink();
597
    $this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
598
599
    $this->assertResponse($response);
    if ($response == 200) {
600
      $this->assertText(t('Edit menu item'), 'Menu edit node was displayed');
601
602
603
    }

    // View menu settings node.
604
    $this->drupalGet('admin/structure/menu/settings');
605
606
    $this->assertResponse($response);
    if ($response == 200) {
607
      $this->assertText(t('Menus'), 'Menu settings node was displayed');
608
609
610
    }

    // View add menu node.
611
    $this->drupalGet('admin/structure/menu/add');
612
613
    $this->assertResponse($response);
    if ($response == 200) {
614
      $this->assertText(t('Menus'), 'Add menu node was displayed');
615
616
617
    }
  }
}