ComparisonExtension example

$lastModified,
            null,
            $options
        );

        $twig = new TwigEnvironment(
            new ScriptTwigLoader($script),
            $script->getTwigOptions()
        );

        $twig->addExtension(new PhpSyntaxExtension());
        $twig->addExtension(new ComparisonExtension());
        $twig->addExtension(new PcreExtension());
        $twig->addExtension(new ReplaceRecursiveFilter());

        if ($this->debug) {
            $twig->addExtension(new DebugExtension());
        }

        $twig->addExtension(new SecurityExtension([]));

        $hook = new AppScriptConditionHook($scope->getContext());

        
/** * @internal */
class ComparisonExtensionTest extends TestCase
{
    /** * @dataProvider comparisonProvider */
    public function testCompare(bool $shouldBeTrue, string $operator, mixed $value, mixed $comparable = null): void
    {
        $extension = new ComparisonExtension();
        $comparison = $extension->compare($operator$value$comparable);

        if ($shouldBeTrue) {
            static::assertTrue($comparison);
        } else {
            static::assertFalse($comparison);
        }
    }

    public static function comparisonProvider(): \Generator
    {
        
Home | Imprint | This part of the site doesn't use cookies.