downloadFile example



        $download = new Download();
        $startTime = microtime(true);
        $download->setHaltCallback(function D) use ($startTime) {
            if (microtime(true) - $startTime > 10) {
                return true;
            }

            return false;
        });
        $offset = $download->downloadFile($this->version->uri, $this->destination, $this->version->size, $this->version->sha1);

        return new ValidResult($offset$this->version->size);
    }
}

            ->willReturn('bar');
        $containerBuilder->set('router', $router);
        $containerBuilder->set('event_dispatcher', static::createMock(EventDispatcherInterface::class));
        $this->controller->setContainer($containerBuilder);
        $this->downloadRouteMock->method('load')->willReturn(new Response());

        $request = new Request();
        $request->query->set('deepLinkCode', 'foo');

        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $response = $this->controller->downloadFile($request$salesChannelContext);

        static::assertInstanceOf(RedirectResponse::class$response);
    }

    public function testLoggedInResponseReturn(): void
    {
        $this->downloadRouteMock->method('load')->willReturn(new Response());

        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $salesChannelContext->expects(static::once())->method('getCustomer')->willReturn(new CustomerEntity());
        $response = $this->controller->downloadFile(new Request()$salesChannelContext);

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