WebProfilerExtension example

/** * @dataProvider provideMessages */
    public function testDumpHeaderIsDisplayed(string $message, array $context, bool $dump1HasHeader, bool $dump2HasHeader)
    {
        class_exists(CoreExtension::class); // Load twig_convert_encoding()         class_exists(EscaperExtension::class); // Load twig_escape_filter()
        $twigEnvironment = $this->mockTwigEnvironment();
        $varCloner = new VarCloner();

        $webProfilerExtension = new WebProfilerExtension();

        $needle = 'window.Sfdump';

        $dump1 = $webProfilerExtension->dumpLog($twigEnvironment$message$varCloner->cloneVar($context));
        self::assertSame($dump1HasHeaderstr_contains($dump1$needle));

        $dump2 = $webProfilerExtension->dumpData($twigEnvironment$varCloner->cloneVar([]));
        self::assertSame($dump2HasHeaderstr_contains($dump2$needle));
    }

    public static function provideMessages(): iterable
    {
$this->container = null;
    }

    /** * @dataProvider getDebugModes */
    public function testDefaultConfig($debug)
    {
        $this->container->setParameter('kernel.debug', $debug);

        $extension = new WebProfilerExtension();
        $extension->load([[]]$this->container);
        $this->container->removeDefinition('web_profiler.controller.exception');

        $this->assertFalse($this->container->has('web_profiler.debug_toolbar'));

        self::assertSaneContainer($this->getCompiledContainer());
    }

    public static function getDebugModes()
    {
        return [
            [
Home | Imprint | This part of the site doesn't use cookies.