ArrayAdapter example

'reset' => '5 minutes',
            'limits' => [
                [
                    'limit' => 3,
                    'interval' => '10 seconds',
                ],
            ],
        ];

        $factory = new RateLimiterFactory(
            $config,
            new CacheStorage(new ArrayAdapter()),
            $this->createMock(SystemConfigService::class),
            $this->createMock(LockFactory::class),
        );

        static::assertInstanceOf(NoLimiter::class$factory->create('example'));
    }

    public function testRateLimitNewsletterForm(): void
    {
        for ($i = 0; $i <= 3; ++$i) {
            $this->browser
                

class CacheInvalidatorStorageTest extends TestCase
{
    /** * @DisabledFeatures("v6.6.0.0") */
    public function testStorage(): void
    {
        $storage = new CacheInvalidatorStorage(new ArrayAdapter());

        static::assertSame($storage->loadAndDelete()[]);

        $storage->store(['foo', 'bar']);

        static::assertSame(['foo', 'bar']$storage->loadAndDelete());
        static::assertSame([]$storage->loadAndDelete());
    }
}
$response = new ProductReviewRouteResponse(
            new EntitySearchResult('product_review', 0, new ProductReviewCollection(), null, $criteria$context->getContext())
        );

        $core = $this->createMock(ProductReviewRoute::class);
        $core->expects(static::exactly(2))
            ->method('load')
            ->willReturn($response);

        $route = new CachedProductReviewRoute(
            $core,
            new TagAwareAdapter(new ArrayAdapter(100)),
            $this->getContainer()->get(EntityCacheKeyGenerator::class),
            $this->getContainer()->get(CacheTracer::class),
            $this->getContainer()->get('event_dispatcher'),
            []
        );

        $ids = new IdsCollection();
        $route->load($ids->get('product')new Request()$context$criteria);

        $route->load($ids->get('product')new Request()$context$criteria);

        
$response = new CountryRouteResponse(
            new EntitySearchResult('country', 0, new CountryCollection(), null, $criteria$context->getContext())
        );

        $core = $this->createMock(CountryRoute::class);
        $core->expects(static::exactly(2))
            ->method('load')
            ->willReturn($response);

        $route = new CachedCountryRoute(
            $core,
            new TagAwareAdapter(new ArrayAdapter(100)),
            $this->getContainer()->get(EntityCacheKeyGenerator::class),
            $this->getContainer()->get(CacheTracer::class),
            $this->getContainer()->get('event_dispatcher'),
            []
        );

        $route->load(new Request()$criteria$context);

        $route->load(new Request()$criteria$context);

        $criteria->setLimit(200);

        
return new RecursiveValidator($contextFactory$metadataFactory$validatorFactory$this->initializers);
    }

    private function createAnnotationReader(): Reader
    {
        if (!class_exists(AnnotationReader::class)) {
            throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.');
        }

        if (class_exists(ArrayAdapter::class)) {
            return new PsrCachedReader(new AnnotationReader()new ArrayAdapter());
        }

        throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.');
    }
}
$response = new SalutationRouteResponse(
            new EntitySearchResult('salutation', 0, new SalutationCollection(), null, $criteria$context->getContext())
        );

        $core = $this->createMock(SalutationRoute::class);
        $core->expects(static::exactly(2))
            ->method('load')
            ->willReturn($response);

        $route = new CachedSalutationRoute(
            $core,
            new TagAwareAdapter(new ArrayAdapter(100)),
            $this->getContainer()->get(EntityCacheKeyGenerator::class),
            $this->getContainer()->get(CacheTracer::class),
            $this->getContainer()->get('event_dispatcher'),
            [],
            $this->getContainer()->get('logger')
        );

        $route->load(new Request()$context$criteria);

        $route->load(new Request()$context$criteria);

        
class FlysystemLastModifiedVersionStrategyTest extends TestCase
{
    private Filesystem $fs;

    private UrlPackage $asset;

    private FlysystemLastModifiedVersionStrategy $strategy;

    protected function setUp(): void
    {
        $this->fs = new Filesystem(new MemoryFilesystemAdapter());
        $this->strategy = new FlysystemLastModifiedVersionStrategy('test', $this->fs, new TagAwareAdapter(new ArrayAdapter()new ArrayAdapter()));
        $this->asset = new UrlPackage(['http://shopware.com']$this->strategy);
    }

    public function testNonExistentFile(): void
    {
        $url = $this->asset->getUrl('test');
        static::assertSame('http://shopware.com/test', $url);
    }

    public function testExistsFile(): void
    {
        
->method('trace')
            ->willReturnCallback(fn (string $name, \Closure $closure) => $closure());

        $requestStack = $this->createMock(RequestStack::class);
        $requestStack->method('getMainRequest')->willReturn(new Request());

        $subscriber = new NotFoundSubscriber(
            $controller,
            $requestStack,
            $this->createMock(SalesChannelContextServiceInterface::class),
            false,
            new TagAwareAdapter(new ArrayAdapter()new ArrayAdapter()),
            $cacheTracer,
            $this->createMock(EntityCacheKeyGenerator::class),
            $this->createMock(CacheInvalidator::class),
            new EventDispatcher()
        );

        $request = new Request();

        $event = new ExceptionEvent(
            $this->createMock(Kernel::class),
            $request,
            

                    'limit' => 7,
                    'interval' => '60 seconds',
                ],
            ],
        ];

        $this->id = $this->config['id'] . '-test';

        $factory = new RateLimiterFactory(
            $this->config,
            new CacheStorage(new ArrayAdapter()),
            $this->createMock(SystemConfigService::class),
            $this->createMock(LockFactory::class)
        );

        $this->limiter = $factory->create('example');
        $this->limiter->reset();

        $this->getContainer()->get('cache.rate_limiter')->clear();
    }

    public function testConsume(): void
    {
Home | Imprint | This part of the site doesn't use cookies.