FormObjectTest.php

Same filename in this branch
  1. 11.x core/modules/system/tests/src/Functional/Form/FormObjectTest.php
Same filename in other branches
  1. 9 core/modules/system/tests/src/Kernel/Form/FormObjectTest.php
  2. 9 core/modules/system/tests/src/Functional/Form/FormObjectTest.php
  3. 8.9.x core/modules/system/tests/src/Kernel/Form/FormObjectTest.php
  4. 8.9.x core/modules/system/tests/src/Functional/Form/FormObjectTest.php
  5. 10 core/modules/system/tests/src/Kernel/Form/FormObjectTest.php
  6. 10 core/modules/system/tests/src/Functional/Form/FormObjectTest.php

Namespace

Drupal\Tests\system\Kernel\Form

File

core/modules/system/tests/src/Kernel/Form/FormObjectTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\system\Kernel\Form;

use Drupal\form_test\FormTestObject;
use Drupal\KernelTests\ConfigFormTestBase;

/**
 * Tests building a form from an object.
 *
 * @group Form
 */
class FormObjectTest extends ConfigFormTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'form_test',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->form = new FormTestObject($this->container
            ->get('config.factory'), $this->container
            ->get('config.typed'));
        $this->values = [
            'bananas' => [
                '#value' => $this->randomString(10),
                '#config_name' => 'form_test.object',
                '#config_key' => 'bananas',
            ],
        ];
    }

}

Classes

Title Deprecated Summary
FormObjectTest Tests building a form from an object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.