You are here

public function IntegrationTest::checkCdfAccess in Acquia Content Hub 8

Ensures the CDF output is present or not depending of selected role.

Parameters

\Drupal\node\NodeInterface $entity: The entity to be used.

bool $access: Expected result.

1 call to IntegrationTest::checkCdfAccess()
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 230

Class

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

Namespace

Drupal\Tests\acquia_contenthub\Functional

Code

public function checkCdfAccess(NodeInterface $entity, $access = TRUE) {
  $output = $this
    ->drupalGetCdf('acquia-contenthub-cdf/' . $entity
    ->getEntityTypeId() . '/' . $entity
    ->id());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  if ($access) {
    $this
      ->assertTrue(isset($output['entities']['0']), 'CDF is present');
  }
  else {
    $this
      ->assertFalse(isset($output['entities']['0']), 'CDF is not present');
  }
}