You are here

public function MachineNameTest::testMachineNameOrderException in Drupal 10

Tests the order of the machine name field and the source.

File

core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php, line 67

Class

MachineNameTest
@coversDefaultClass \Drupal\Core\Render\Element\MachineName @group Render

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testMachineNameOrderException() {
  $this
    ->expectException(\LogicException::class);
  $this
    ->expectErrorMessage('The machine name element "test_machine_name" is defined before the source element "test_source", it must be defined after or the source element must specify an id.');
  $form = \Drupal::formBuilder()
    ->getForm($this);
  $this
    ->render($form);
}