public function GridStackSettingsFormTest::testGridStackSettingsForm in GridStack 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/Form/GridStackSettingsFormTest.php \Drupal\Tests\gridstack\Kernel\Form\GridStackSettingsFormTest::testGridStackSettingsForm()
Tests for \Drupal\gridstack_ui\Form\GridStackSettingsForm.
@covers ::getFormId @covers ::getEditableConfigNames @covers ::buildForm @covers ::submitForm
File
- tests/
src/ Kernel/ Form/ GridStackSettingsFormTest.php, line 86
Class
- GridStackSettingsFormTest
- Tests the GridStack UI settings form.
Namespace
Drupal\Tests\gridstack\Kernel\FormCode
public function testGridStackSettingsForm() {
// Emulate a form state of a submitted form.
$form_state = (new FormState())
->setValues([
'customized' => TRUE,
]);
$this
->assertInstanceOf(FormInterface::class, $this->gridstackSettingsForm);
$this
->assertEquals('bootstrap', $this->blazyManager
->getConfigFactory()
->get('gridstack.settings')
->get('framework'));
$id = $this->gridstackSettingsForm
->getFormId();
$this
->assertEquals('gridstack_settings_form', $id);
$method = new \ReflectionMethod(GridStackSettingsForm::class, 'getEditableConfigNames');
$method
->setAccessible(TRUE);
$name = $method
->invoke($this->gridstackSettingsForm);
$this
->assertEquals([
'gridstack.settings',
], $name);
$form = $this->gridstackSettingsForm
->buildForm([], $form_state);
$this->gridstackSettingsForm
->submitForm($form, $form_state);
}