function ConfigFormBaseTraitTest::testConfigFactoryExceptionInvalidProperty

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php \Drupal\Tests\Core\Form\ConfigFormBaseTraitTest::testConfigFactoryExceptionInvalidProperty()
  2. 8.9.x core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php \Drupal\Tests\Core\Form\ConfigFormBaseTraitTest::testConfigFactoryExceptionInvalidProperty()
  3. 11.x core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php \Drupal\Tests\Core\Form\ConfigFormBaseTraitTest::testConfigFactoryExceptionInvalidProperty()

@covers ::config

File

core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php, line 60

Class

ConfigFormBaseTraitTest
@coversDefaultClass \Drupal\Core\Form\ConfigFormBaseTrait[[api-linebreak]] @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testConfigFactoryExceptionInvalidProperty() : void {
  $testObject = new ConfiguredTrait();
  // There is no config factory available this should result in an exception.
  $this->expectException(\LogicException::class);
  $this->expectExceptionMessage('No config factory available for ConfigFormBaseTrait');
  $config_method = new \ReflectionMethod($testObject, 'config');
  $config_method->invoke($testObject, 'editable.config');
}

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