public function CalendarLinkTwigExtensionTest::testFunctionsRegistered in Calendar Link 2.x
Same name and namespace in other branches
- 8 tests/src/Kernel/CalendarLinkTwigExtensionTest.php \Drupal\Tests\calendar_link\Kernel\CalendarLinkTwigExtensionTest::testFunctionsRegistered()
Tests that the Twig extension functions are registered properly.
File
- tests/
src/ Kernel/ CalendarLinkTwigExtensionTest.php, line 38
Class
- CalendarLinkTwigExtensionTest
- Tests Twig extensions.
Namespace
Drupal\Tests\calendar_link\KernelCode
public function testFunctionsRegistered() {
/** @var \Twig_SimpleFunction[] $functions */
$registered_functions = \Drupal::service('twig')
->getFunctions();
$functions = [
'calendar_link',
'calendar_links',
];
foreach ($functions as $name) {
$function = $registered_functions[$name];
$this
->assertTrue($function instanceof \Twig_SimpleFunction);
$this
->assertEquals($function
->getName(), $name);
is_callable($function
->getCallable(), TRUE, $callable);
}
}