You are here

public function FormBuilderTest::testGetFormIdWithClassName in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormIdWithClassName()

Tests the getFormId() method with a class name form ID.

File

core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php, line 68
Contains \Drupal\Tests\Core\Form\FormBuilderTest.

Class

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

Namespace

Drupal\Tests\Core\Form

Code

public function testGetFormIdWithClassName() {
  $form_arg = 'Drupal\\Tests\\Core\\Form\\TestForm';
  $form_state = new FormState();
  $form_id = $this->formBuilder
    ->getFormId($form_arg, $form_state);
  $this
    ->assertSame('test_form', $form_id);
  $this
    ->assertSame($form_arg, get_class($form_state
    ->getFormObject()));
}