You are here

public function GdprFieldConfigTest::testViewFieldsList in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 8 modules/gdpr_fields/tests/src/Functional/GdprFieldConfigTest.php \Drupal\Tests\gdpr_fields\Functional\GdprFieldConfigTest::testViewFieldsList()
  2. 3.0.x modules/gdpr_fields/tests/src/Functional/GdprFieldConfigTest.php \Drupal\Tests\gdpr_fields\Functional\GdprFieldConfigTest::testViewFieldsList()

Test installing gdpr_fields module and field config list works.

File

modules/gdpr_fields/tests/src/Functional/GdprFieldConfigTest.php, line 48

Class

GdprFieldConfigTest
Tests GDPR fields and configuration.

Namespace

Drupal\Tests\gdpr_fields\Functional

Code

public function testViewFieldsList() {

  // Check the site has installed successfully.
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Check that prior to logging in, we can't access the fields list.
  $this
    ->drupalGet('admin/reports/fields/gdpr-fields');
  $this
    ->assertSession()
    ->statusCodeEquals(403);

  // Gain access to the fields list.
  $this
    ->drupalLogin($this->adminUser);

  // Check that the fields list has the expected content.
  $this
    ->drupalGet('admin/reports/fields/gdpr-fields');
  $session = $this
    ->assertSession();
  $session
    ->statusCodeEquals(200);
  $session
    ->elementTextContains('css', '.page-title', 'Used in GDPR');

  // @todo Check that some user fields are present.
}