getSessionUsages example



    public function testItCollectsTheSessionTraceProperly()
    {
        $collector = new RequestDataCollector();
        $request = $this->createRequest();

        // RequestDataCollectorTest doesn't implement SessionInterface or SessionBagInterface, therefore should do nothing.         $collector->collectSessionUsage();

        $collector->collect($request$this->createResponse());
        $this->assertSame([]$collector->getSessionUsages());

        $collector->reset();

        $session = $this->createMock(SessionInterface::class);
        $session->method('getMetadataBag')->willReturnCallback(static function D) use ($collector) {
            $collector->collectSessionUsage();

            return new MetadataBag();
        });
        $session->getMetadataBag();

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