public function AjaxFormCacheTest::testBlockForms in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php \Drupal\system\Tests\Ajax\AjaxFormCacheTest::testBlockForms()
Tests AJAX forms in blocks.
File
- core/
modules/ system/ src/ Tests/ Ajax/ AjaxFormCacheTest.php, line 45 - Contains \Drupal\system\Tests\Ajax\AjaxFormCacheTest.
Class
- AjaxFormCacheTest
- Tests the usage of form caching for AJAX forms.
Namespace
Drupal\system\Tests\AjaxCode
public function testBlockForms() {
$this->container
->get('module_installer')
->install([
'block',
'search',
]);
$this
->rebuildContainer();
$this->container
->get('router.builder')
->rebuild();
$this
->drupalLogin($this->rootUser);
$this
->drupalPlaceBlock('search_form_block', [
'weight' => -5,
]);
$this
->drupalPlaceBlock('ajax_forms_test_block');
$this
->drupalGet('');
$this
->drupalPostAjaxForm(NULL, [
'test1' => 'option1',
], 'test1');
$this
->assertOptionSelectedWithDrupalSelector('edit-test1', 'option1');
$this
->assertOptionWithDrupalSelector('edit-test1', 'option3');
$this
->drupalPostForm(NULL, [
'test1' => 'option1',
], 'Submit');
$this
->assertText('Submission successful.');
}