public function ConditionFormTest::testConfigForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php \Drupal\Tests\system\Functional\Condition\ConditionFormTest::testConfigForm()
- 10 core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php \Drupal\Tests\system\Functional\Condition\ConditionFormTest::testConfigForm()
Submit the condition_node_type_test_form to test condition forms.
File
- core/
modules/ system/ tests/ src/ Functional/ Condition/ ConditionFormTest.php, line 29
Class
- ConditionFormTest
- Tests that condition plugins basic form handling is working.
Namespace
Drupal\Tests\system\Functional\ConditionCode
public function testConfigForm() {
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Page',
]);
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$article = Node::create([
'type' => 'article',
'title' => $this
->randomMachineName(),
]);
$article
->save();
$this
->drupalGet('condition_test');
$this
->assertSession()
->fieldExists('bundles[article]');
$this
->assertSession()
->fieldExists('bundles[page]');
$this
->submitForm([
'bundles[page]' => 'page',
'bundles[article]' => 'article',
], 'Submit');
// @see \Drupal\condition_test\FormController::submitForm()
$this
->assertSession()
->pageTextContains('Bundle: page');
$this
->assertSession()
->pageTextContains('Bundle: article');
$this
->assertSession()
->pageTextContains('Executed successfully.');
}