public function ConfigFormBaseTraitTest::testConfigFactoryException in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php \Drupal\Tests\Core\Form\ConfigFormBaseTraitTest::testConfigFactoryException()
@covers ::config
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ ConfigFormBaseTraitTest.php, line 45
Class
- ConfigFormBaseTraitTest
- @coversDefaultClass \Drupal\Core\Form\ConfigFormBaseTrait @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testConfigFactoryException() {
$trait = $this
->getMockForTrait('Drupal\\Core\\Form\\ConfigFormBaseTrait');
$config_method = new \ReflectionMethod($trait, 'config');
$config_method
->setAccessible(TRUE);
// 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
->invoke($trait, 'editable.config');
}