From df6360044b5c2396b2bee0dfa9e8d744bfa424d5 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 26 Aug 2018 12:23:47 +0200 Subject: Added Twig template functions --- .../Renderer/Twig/Extensions/ExtensionTest.php | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php (limited to 'tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php') diff --git a/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php new file mode 100644 index 00000000..10f2e69a --- /dev/null +++ b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php @@ -0,0 +1,48 @@ +getName() != $name) { + continue; + } + + $this->assertEquals($callback, $function->getCallable()); + return; + } + + $this->fail(sprintf('Function %s not found', $name)); + } + + /** + * Assert that a global exists + * + * @param string $name + * @param mixed $value + * @param mixed[] $globals + */ + protected function assertGlobalsExists($name, $value, $globals) + { + if (isset($globals[$name])) { + $this->assertArraySubset([$name => $value], $globals); + + return; + } + + $this->fail(sprintf('Global %s not found', $name)); + } +} -- cgit v1.2.3-54-g00ecf