public function EntityLegalMethodsTest::testSignupFormLinkMethod in Entity Legal 4.0.x
Same name and namespace in other branches
- 8.2 src/Tests/EntityLegalMethodsTest.php \Drupal\entity_legal\Tests\EntityLegalMethodsTest::testSignupFormLinkMethod()
- 3.0.x src/Tests/EntityLegalMethodsTest.php \Drupal\entity_legal\Tests\EntityLegalMethodsTest::testSignupFormLinkMethod()
User signup form with link method test.
File
- src/
Tests/ EntityLegalMethodsTest.php, line 100
Class
- EntityLegalMethodsTest
- Tests methods of encouraging users to accept legal documents.
Namespace
Drupal\entity_legal\TestsCode
public function testSignupFormLinkMethod() {
$document = $this
->createDocument(TRUE, TRUE, [
'new_users' => [
'require_method' => 'form_link',
],
]);
$this
->createDocumentVersion($document, TRUE);
$this
->drupalGet('user/register');
$this
->assertFieldByName('legal_' . $document
->id(), NULL, 'Agree checkbox found');
/** @var \Drupal\Core\Url $document_url */
$document_url = $document
->toUrl();
$document_path = $document_url
->toString();
$this
->assertLinkByHref($document_path, 0, 'Link to document found');
// 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());
}