function ActionMethodAttributeTest::testInvalidFunctionName

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Config/Action/ActionMethodAttributeTest.php \Drupal\Tests\Core\Config\Action\ActionMethodAttributeTest::testInvalidFunctionName()

Tests invalid function name.

@legacy-covers ::__construct

File

core/tests/Drupal/Tests/Core/Config/Action/ActionMethodAttributeTest.php, line 25

Class

ActionMethodAttributeTest
Tests Drupal\Core\Config\Action\Attribute\ActionMethod.

Namespace

Drupal\Tests\Core\Config\Action

Code

public function testInvalidFunctionName() : void {
  $name = "hello Goodbye";
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->expectExceptionMessage("'{$name}' is not a valid PHP function name.");
  new ActionMethod(name: $name);
}

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