getCustomerFromToken example

protected function setUp(): void
    {
        $this->accountService = $this->getContainer()->get(AccountService::class);
    }

    public function testLogin(): void
    {
        $salesChannelContext = $this->createSalesChannelContext();
        $customerId = $this->createCustomerOfSalesChannel($salesChannelContext->getSalesChannelId(), '[email protected]');
        $token = $this->accountService->login('[email protected]', $salesChannelContext);

        $customer = $this->getCustomerFromToken($token$salesChannelContext->getSalesChannelId());

        static::assertSame('[email protected]', $customer->getEmail());
        static::assertSame($customerId$customer->getId());
    }

    public function testLoginById(): void
    {
        $salesChannelContext = $this->createSalesChannelContext();
        $customerId = $this->createCustomerOfSalesChannel($salesChannelContext->getSalesChannelId(), '[email protected]');
        $token = $this->accountService->loginById($customerId$salesChannelContext);

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