You are here

public function NodeContextualLinksTest::testPageWithDisabledContextualModule in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/Views/NodeContextualLinksTest.php \Drupal\node\Tests\Views\NodeContextualLinksTest::testPageWithDisabledContextualModule()

Tests if the node page works if Contextual Links is disabled.

All views have Contextual links enabled by default, even with the Contextual links module disabled. This tests if no calls are done to the Contextual links module by views when it is disabled.

See also

https://www.drupal.org/node/2379811

File

core/modules/node/src/Tests/Views/NodeContextualLinksTest.php, line 106
Contains \Drupal\node\Tests\Views\NodeContextualLinksTest.

Class

NodeContextualLinksTest
Tests views contextual links on nodes.

Namespace

Drupal\node\Tests\Views

Code

public function testPageWithDisabledContextualModule() {
  \Drupal::service('module_installer')
    ->uninstall([
    'contextual',
  ]);
  \Drupal::service('module_installer')
    ->install([
    'views_ui',
  ]);

  // Ensure that contextual links don't get called for admin users.
  $admin_user = User::load(1);
  $admin_user
    ->setPassword('new_password');
  $admin_user->pass_raw = 'new_password';
  $admin_user
    ->save();
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
  ));
  $this
    ->drupalCreateNode(array(
    'promote' => 1,
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('node');
}