function FormBuilderTest::testGetFormIdWithNonFormClass

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormIdWithNonFormClass()
  2. 11.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormIdWithNonFormClass()

@covers ::getFormId

File

core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php, line 70

Class

FormBuilderTest
@coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testGetFormIdWithNonFormClass() {
    $form_arg = __CLASS__;
    $form_state = new FormState();
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage("The form argument {$form_arg} must be an instance of \\Drupal\\Core\\Form\\FormInterface.");
    $this->formBuilder
        ->getFormId($form_arg, $form_state);
}

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