GdprFieldConfigTest.php in General Data Protection Regulation 3.0.x
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 {
protected static $modules = [
'gdpr',
'gdpr_fields',
'gdpr_tasks',
'gdpr_consent',
'anonymizer',
'file',
];
protected $adminUser;
protected $defaultTheme = 'stark';
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', 'h1', 'Used in GDPR');
}
}