function MachineNameTest::testMachineNameOrderException

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php \Drupal\KernelTests\Core\Render\Element\MachineNameTest::testMachineNameOrderException()
  2. 10 core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php \Drupal\KernelTests\Core\Render\Element\MachineNameTest::testMachineNameOrderException()

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

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testMachineNameOrderException() : void {
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('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);
}

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