You are here

public function IntegrationTest::checkAccessViewMode in Acquia Content Hub 8

Checks access to View Modes endpoint.

Parameters

\Drupal\node\NodeInterface $entity: The entity.

string $view_mode: The view mode.

bool $access: Expected result.

1 call to IntegrationTest::checkAccessViewMode()
IntegrationTest::testFramework in tests/src/Functional/IntegrationTest.php
Tests various operations via the Acquia Content Hub admin UI.

File

tests/src/Functional/IntegrationTest.php, line 382

Class

IntegrationTest
Tests the overall functionality of the Acquia Content Hub module.

Namespace

Drupal\Tests\acquia_contenthub\Functional

Code

public function checkAccessViewMode(NodeInterface $entity, $view_mode, $access = TRUE) {
  $this
    ->drupalGet("acquia-contenthub/display/node/{$entity->id()}/{$view_mode}");
  if ($access) {
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    $this
      ->assertText($entity
      ->label());
  }
  else {
    $this
      ->assertSession()
      ->statusCodeEquals(403);
  }
}