protected function WebformElementSignatureTest::assertSignature in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/Functional/Element/WebformElementSignatureTest.php \Drupal\Tests\webform\Functional\Element\WebformElementSignatureTest::assertSignature()
Assert valid or invalid signature.
Parameters
string $value: Signature value.
bool $is_valid: Is Signature valid.
1 call to WebformElementSignatureTest::assertSignature()
- WebformElementSignatureTest::testSignature in tests/
src/ Functional/ Element/ WebformElementSignatureTest.php - Test signature element.
File
- tests/
src/ Functional/ Element/ WebformElementSignatureTest.php, line 91
Class
- WebformElementSignatureTest
- Tests for signature element.
Namespace
Drupal\Tests\webform\Functional\ElementCode
protected function assertSignature($value, $is_valid = TRUE) {
// Must manually set hidden values because ::submitForm only set visible
// element values and ignores hidden elements.
// @see \Drupal\Tests\UiHelperTrait::submitForm
$this
->drupalGet('/webform/test_element_signature');
$field = $this
->assertSession()
->hiddenFieldExists('signature');
$field
->setValue($value);
$this
->submitForm([], 'Submit');
if ($is_valid) {
$this
->assertNoRaw('signature contains an invalid signature.');
}
else {
$this
->assertRaw('signature contains an invalid signature.');
}
}