AppJWTGenerateRoute example

use Shopware\Core\Test\Generator;

/** * @internal * * @covers \Shopware\Core\Framework\App\Api\AppJWTGenerateRoute */
class AppJWTGenerateRouteTest extends TestCase
{
    public function testNotLoggedIn(): void
    {
        $appJWTGenerateRoute = new AppJWTGenerateRoute(
            $this->createMock(Connection::class),
            $this->createMock(ShopIdProvider::class)
        );

        $context = Generator::createSalesChannelContext();
        $context->assign(['customer' => null]);

        static::expectException(AppException::class);
        static::expectExceptionMessage('JWT generation requires customer to be logged in');
        $appJWTGenerateRoute->generate('test', $context);
    }

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