3 namespace Drupal\Tests\system\Functional\Condition;
5 use Drupal\node\Entity\Node;
6 use Drupal\Tests\BrowserTestBase;
9 * Tests that condition plugins basic form handling is working.
11 * Checks condition forms and submission and gives a very cursory check to make
12 * sure the configuration that was submitted actually causes the condition to
17 class ConditionFormTest extends BrowserTestBase {
19 public static $modules = ['node', 'condition_test'];
22 * Submit the condition_node_type_test_form to test condition forms.
24 public function testConfigForm() {
25 $this->drupalCreateContentType(['type' => 'page', 'name' => 'Page']);
26 $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
28 $article = Node::create([
30 'title' => $this->randomMachineName(),
34 $this->drupalGet('condition_test');
35 $this->assertField('bundles[article]', 'There is an article bundle selector.');
36 $this->assertField('bundles[page]', 'There is a page bundle selector.');
37 $this->drupalPostForm(NULL, ['bundles[page]' => 'page', 'bundles[article]' => 'article'], t('Submit'));
38 // @see \Drupal\condition_test\FormController::submitForm()
39 $this->assertText('Bundle: page');
40 $this->assertText('Bundle: article');
41 $this->assertText('Executed successfully.', 'The form configured condition executed properly.');