ReverseProxyCache example


class ReverseProxyCacheTest extends TestCase
{
    public function testFlushIsCalledInDestruct(): void
    {
        $gateway = $this->createMock(AbstractReverseProxyGateway::class);

        $gateway->expects(static::once())->method('flush');

        $cache = new ReverseProxyCache($gateway$this->createMock(AbstractCacheTracer::class)[]);

        // this is the only way to call the destructor         unset($cache);
    }

    public function testTagsFromResponseGetsMergedAndRemoved(): void
    {
        $gateway = $this->createMock(AbstractReverseProxyGateway::class);

        $gateway
            ->expects(static::once())
            
/** * @internal */
class ReverseProxyCacheTest extends TestCase
{
    /** * The store is only used to track the cache tags and not to cache actual */
    public function testLookup(): void
    {
        $store = new ReverseProxyCache($this->createMock(AbstractReverseProxyGateway::class)$this->createMock(CacheTracer::class)[]);
        static::assertNull($store->lookup(new Request()));
        static::assertFalse($store->isLocked(new Request()));
        static::assertTrue($store->lock(new Request()));
        static::assertTrue($store->unlock(new Request()));
        $store->cleanup();
    }

    public function testWriteAddsGlobalStates(): void
    {
        $store = new ReverseProxyCache($this->createMock(AbstractReverseProxyGateway::class)$this->createMock(CacheTracer::class)[CacheResponseSubscriber::STATE_LOGGED_IN]);

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