setTimeStamp example


            );

        $response = $this->browser->getResponse();
        $originalToken = $response->headers->get(PlatformRequest::HEADER_CONTEXT_TOKEN);
        static::assertNotNull($originalToken);
        static::assertNotFalse($response->getContent());
        $data = \json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR);
        static::assertCount(1, $data['lineItems']);

        $interval = new \DateInterval($this->getContainer()->getParameter('shopware.api.store.context_lifetime'));
        $intervalInSeconds = (new \DateTime())->setTimeStamp(0)->add($interval)->getTimeStamp();
        $intervalInDays = $intervalInSeconds / 86400 + 1;

        // expire $originalToken context         $connection->executeStatement(
            ' UPDATE sales_channel_api_context SET updated_at = DATE_ADD(updated_at, INTERVAL :intervalInDays DAY)',
            ['intervalInDays' => -$intervalInDays]
        );

        $this->browser->request('GET', '/store-api/checkout/cart');

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