GdprFieldConfigTest.php in General Data Protection Regulation 8
File
modules/gdpr_fields/tests/src/Functional/GdprFieldConfigTest.php
View source
<?php
namespace Drupal\Tests\gdpr_fields\Functional;
use Drupal\Tests\BrowserTestBase;
class GdprFieldConfigTest extends BrowserTestBase {
public static $modules = [
'gdpr',
'gdpr_fields',
'gdpr_tasks',
'gdpr_consent',
'anonymizer',
'file',
];
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->createUser([], NULL, TRUE);
$this->adminUser
->addRole('administrator');
$this->adminUser
->save();
}
public function testViewFieldsList() {
$this
->drupalGet('');
$this
->assertSession()
->statusCodeEquals(200);
$this
->drupalGet('admin/reports/fields/gdpr-fields');
$this
->assertSession()
->statusCodeEquals(403);
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/reports/fields/gdpr-fields');
$session = $this
->assertSession();
$session
->statusCodeEquals(200);
$session
->elementTextContains('css', '.page-title', 'Used in GDPR');
}
}