public function BlazySettingsFormTest::testBlazySettingsForm in Blazy 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/Form/BlazySettingsFormTest.php \Drupal\Tests\blazy\Kernel\Form\BlazySettingsFormTest::testBlazySettingsForm()
Tests for \Drupal\blazy_ui\Form\BlazySettingsForm.
@covers ::getFormId @covers ::getEditableConfigNames @covers ::buildForm @covers ::submitForm
File
- tests/
src/ Kernel/ Form/ BlazySettingsFormTest.php, line 64
Class
- BlazySettingsFormTest
- Tests the Blazy UI settings form.
Namespace
Drupal\Tests\blazy\Kernel\FormCode
public function testBlazySettingsForm() {
// Emulate a form state of a submitted form.
$form_state = (new FormState())
->setValues([
'admin_css' => TRUE,
'responsive_image' => FALSE,
]);
$this
->assertInstanceOf(FormInterface::class, $this->blazySettingsForm);
$this
->assertTrue($this->blazyManager
->getConfigFactory()
->get('blazy.settings')
->get('admin_css'));
$id = $this->blazySettingsForm
->getFormId();
$this
->assertEquals('blazy_settings', $id);
$method = new \ReflectionMethod(BlazySettingsForm::class, 'getEditableConfigNames');
$method
->setAccessible(TRUE);
$name = $method
->invoke($this->blazySettingsForm);
$this
->assertEquals([
'blazy.settings',
], $name);
$form = $this->blazySettingsForm
->buildForm([], $form_state);
$this->blazySettingsForm
->submitForm($form, $form_state);
}