You are here

public function EntityLegalMethodsTest::testProfileFormInlineMethod in Entity Legal 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Tests/EntityLegalMethodsTest.php \Drupal\entity_legal\Tests\EntityLegalMethodsTest::testProfileFormInlineMethod()
  2. 4.0.x src/Tests/EntityLegalMethodsTest.php \Drupal\entity_legal\Tests\EntityLegalMethodsTest::testProfileFormInlineMethod()

User signup form with inline method test.

File

src/Tests/EntityLegalMethodsTest.php, line 126

Class

EntityLegalMethodsTest
Tests methods of encouraging users to accept legal documents.

Namespace

Drupal\entity_legal\Tests

Code

public function testProfileFormInlineMethod() {
  $document = $this
    ->createDocument(TRUE, TRUE, [
    'new_users' => [
      'require_method' => 'form_inline',
    ],
  ]);
  $this
    ->createDocumentVersion($document, TRUE);
  $this
    ->drupalGet('user/register');
  $this
    ->assertFieldByName('legal_' . $document
    ->id(), NULL, 'Agree checkbox found');
  $this
    ->assertRaw('<div class="clearfix text-formatted field field--name-entity-legal-document-text', 'Document markup found on register page');

  // Ensure the field extra field is available for re-ordering.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/people/accounts/form-display');
  $this
    ->assertText('legal_' . $document
    ->id());
}