You are here

public function DomainEntityReferenceTest::testDomainField in Domain Access 8

Create, edit and delete a domain field via the user interface.

File

domain/tests/src/Functional/DomainEntityReferenceTest.php, line 22

Class

DomainEntityReferenceTest
Tests the domain record entity reference field type.

Namespace

Drupal\Tests\domain\Functional

Code

public function testDomainField() {
  $this->admin_user = $this
    ->drupalCreateUser([
    'administer content types',
    'administer node fields',
    'administer node display',
    'administer domains',
  ]);
  $this
    ->drupalLogin($this->admin_user);

  // Visit the article field administration page.
  $this
    ->drupalGet('admin/structure/types/manage/article/fields');
  $this
    ->assertResponse(200, 'Manage fields page accessed.');

  // Check for a domain field.
  $this
    ->assertNoText('Domain test field', 'Domain form field not found.');

  // Visit the article field display administration page.
  $this
    ->drupalGet('admin/structure/types/manage/article/display');
  $this
    ->assertResponse(200, 'Manage field display page accessed.');

  // Check for a domain field.
  $this
    ->assertNoText('Domain test field', 'Domain form field not found.');

  // Create test domain field.
  $this
    ->domainCreateTestField();

  // Visit the article field administration page.
  $this
    ->drupalGet('admin/structure/types/manage/article/fields');

  // Check the new field.
  $this
    ->assertText('Domain test field', 'Added a test field instance.');

  // Visit the article field display administration page.
  $this
    ->drupalGet('admin/structure/types/manage/article/display');

  // Check the new field.
  $this
    ->assertText('Domain test field', 'Added a test field display instance.');

  // Visit the field config page.
  $this
    ->drupalGet('admin/config/people/accounts/fields/user.user.field_domain_access');
}