function DatelistElementFormTest::testDatelistElementUntrustedCallbacks
Tests that exceptions are raised if untrusted callbacks are used.
Attributes
#[IgnoreDeprecations]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatelistElementFormTest.php, line 118
Class
- DatelistElementFormTest
- Tests Datelist functionality.
Namespace
Drupal\KernelTests\Core\DatetimeCode
public function testDatelistElementUntrustedCallbacks() : void {
$this->expectException(UntrustedCallbackException::class);
$this->expectExceptionMessage(sprintf('Datelist element #date_date_callbacks callbacks must be methods of a class that implements \\Drupal\\Core\\Security\\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/3217966', Variable::callableToString([
$this,
'datelistDateCallback',
])));
\Drupal::formBuilder()->getForm($this, 'datelistDateCallback');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.