TemplateScopeDetector example

use Symfony\Component\HttpFoundation\RequestStack;

/** * @internal * * @covers \Shopware\Core\Framework\Adapter\Twig\TemplateScopeDetector */
class TemplateScopeDetectorTest extends TestCase
{
    public function testDetectWithNoRequest(): void
    {
        $detector = new TemplateScopeDetector(new RequestStack());
        static::assertSame([TemplateScopeDetector::DEFAULT_SCOPE]$detector->getScopes());
    }

    public function testDetectWithEmptyRequest(): void
    {
        $stack = new RequestStack();
        $stack->push(new Request());
        $detector = new TemplateScopeDetector($stack);
        static::assertSame([TemplateScopeDetector::DEFAULT_SCOPE]$detector->getScopes());
    }

    
Home | Imprint | This part of the site doesn't use cookies.