function DatelistElementFormTest::testDatelistElementUntrustedCallbacks
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatelistElementFormTest::testDatelistElementUntrustedCallbacks()
- 11.x core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatelistElementFormTest::testDatelistElementUntrustedCallbacks()
Tests that deprecations are raised if untrusted callbacks are used.
@group legacy
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatelistElementFormTest.php, line 123
Class
- DatelistElementFormTest
- Tests Datelist functionality.
Namespace
Drupal\KernelTests\Core\DatetimeCode
public function testDatelistElementUntrustedCallbacks() : void {
$form = \Drupal::formBuilder()->getForm($this, 'datelistDateCallback');
$this->expectDeprecation(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. Support for this callback implementation is deprecated in drupal:9.3.0 and will be removed in drupal:10.0.0. See https://www.drupal.org/node/3217966', Variable::callableToString([
$this,
'datelistDateCallback',
])));
$this->render($form);
$this->assertTrue($form['datelist_element']['datelistDateCallbackExecuted']['#value']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.