getHook example

$criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('appId', $appId));
        $criteria->addSorting(new FieldSorting('name', FieldSorting::DESCENDING));
        $scripts = $scriptRepository->search($criteria$this->context)->getEntities();

        static::assertCount(6, $scripts);

        /** @var ScriptEntity $script */
        $script = $scripts->first();
        static::assertEquals('product-page-loaded/product-page-script.twig', $script->getName());
        static::assertEquals('product-page-loaded', $script->getHook());
        static::assertStringEqualsFile(
            __DIR__ . '/../Manifest/_fixtures/test/Resources/scripts/product-page-loaded/product-page-script.twig',
            $script->getScript()
        );
        static::assertEquals($active$script->isActive());

        $cache = $this->getContainer()->get('cache.object');
        static::assertTrue($cache->hasItem(ScriptLoader::CACHE_KEY));

        $item = $cache->getItem(ScriptLoader::CACHE_KEY);
        $cachedScripts = CacheCompressor::uncompress($item);
        
Home | Imprint | This part of the site doesn't use cookies.