assertExceptionResponse example


    use IntegrationTestBehaviour;
    use SalesChannelApiTestBehaviour;

    private const MAINTENANCE_ALLOWED_IPS = ['192.168.0.2', '192.168.0.1', '192.168.0.3'];

    public function testInactiveSalesChannel(): void
    {
        $browser = $this->createSalesChannelBrowser(salesChannelOverrides: ['active' => false]);
        $browser->request(Request::METHOD_GET, '/store-api/test/sales-channel-authentication-listener/default');

        $this->assertExceptionResponse(
            $browser,
            Response::HTTP_PRECONDITION_FAILED,
            ApiException::salesChannelNotFound()->getErrorCode()
        );
    }

    public function testActiveSalesChannel(): void
    {
        $browser = $this->createSalesChannelBrowser(salesChannelOverrides: ['active' => true]);
        $browser->request(Request::METHOD_GET, '/store-api/test/sales-channel-authentication-listener/default');

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