WebformAlterHooksTest.php in Webform 8.5
File
tests/src/Functional/WebformAlterHooksTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional;
use Drupal\Tests\webform_node\Functional\WebformNodeBrowserTestBase;
class WebformAlterHooksTest extends WebformNodeBrowserTestBase {
public static $modules = [
'webform_node',
'webform_test_alter_hooks',
];
public function testWebformAlterHooks() {
$this
->drupalGet('/webform/contact');
$this
->assertRaw("hook_webform_submission_form_alter(): 'webform_submission_contact_add_form' executed.");
$this
->assertRaw("hook_form_alter(): 'webform_submission_contact_add_form' executed.");
$this
->assertRaw("hook_form_webform_submission_BASE_FORM_ID_form_alter(): 'webform_submission_contact_add_form' executed.");
$this
->assertRaw("hook_form_webform_submission_FORM_ID_form_alter(): 'webform_submission_contact_add_form' executed.");
$this
->assertRaw("hook_webform_element_alter(): 'name' executed.");
$this
->assertRaw("hook_webform_element_alter(): 'email' executed.");
$this
->assertRaw("hook_webform_element_ELEMENT_TYPE_alter(): 'email' executed.");
$this
->assertRaw("hook_webform_element_alter(): 'subject' executed.");
$this
->assertRaw("hook_webform_element_alter(): 'message' executed.");
$webform_node = $this
->createWebformNode('contact');
$nid = $webform_node
->id();
$this
->drupalGet("node/{$nid}");
$this
->assertRaw("hook_webform_submission_form_alter(): 'webform_submission_contact_node_{$nid}_add_form' executed.");
$this
->assertRaw("hook_form_alter(): 'webform_submission_contact_node_{$nid}_add_form' executed.");
$this
->assertRaw("hook_form_webform_submission_BASE_FORM_ID_form_alter(): 'webform_submission_contact_node_{$nid}_add_form' executed.");
$this
->assertRaw("hook_form_webform_submission_FORM_ID_form_alter(): 'webform_submission_contact_node_{$nid}_add_form' executed.");
}
}