Convenient test client that makes requests to a Kernel object.
class ApiPlatform\Symfony\Bundle\Test\Client implements Symfony\Contracts\HttpClient\HttpClientInterface
{
public __construct(Symfony\Bundle\FrameworkBundle\KernelBrowser $kernelBrowser, array $defaultOptions)
public setDefaultOptions(array $defaultOptions): null
public request(string $method, string $url, array $options): Symfony\Contracts\HttpClient\ResponseInterface
public stream(Symfony\Contracts\HttpClient\ResponseInterface|Traversable|array $responses, null|float $timeout): Symfony\Contracts\HttpClient\ResponseStreamInterface
public getResponse(): ApiPlatform\Symfony\Bundle\Test\Response
public getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowser
public getContainer(): Symfony\Component\DependencyInjection\ContainerInterface
public getCookieJar(): Symfony\Component\BrowserKit\CookieJar
public getKernel(): Symfony\Component\HttpKernel\KernelInterface
public getProfile(): Symfony\Component\HttpKernel\Profiler\Profile|false
public enableProfiler(): null
public disableReboot(): null
public enableReboot(): null
public loginUser(Symfony\Component\Security\Core\User\UserInterface $user, string $firewallContext): ApiPlatform\Symfony\Bundle\Test\Client
public withOptions(array $options): static
}
public __construct(Symfony\Bundle\FrameworkBundle\KernelBrowser $kernelBrowser, array $defaultOptions)
kernelBrowser | Symfony\Bundle\FrameworkBundle\KernelBrowser | |
defaultOptions | array | Default options for the requests |
Sets the default options for the requests.
public setDefaultOptions(array $defaultOptions): null
defaultOptions | array |
null
Requests an HTTP resource.Responses MUST be lazy, but their status code MUST be checked even if none of their public methods are called.Implementations are not required to support all options described above; they can also support more custom options; but in any case, they MUST throw a TransportExceptionInterface when an unsupported option is passed.
public request(string $method, string $url, array $options): Symfony\Contracts\HttpClient\ResponseInterface
method | string | |
url | string | |
options | array |
Symfony\Contracts\HttpClient\ResponseInterface
Yields responses chunk by chunk as they complete.
public stream(Symfony\Contracts\HttpClient\ResponseInterface|Traversable|array $responses, null|float $timeout): Symfony\Contracts\HttpClient\ResponseStreamInterface
responses | Symfony\Contracts\HttpClient\ResponseInterface Traversable array | |
timeout | float |
Symfony\Contracts\HttpClient\ResponseStreamInterface
Gets the latest response.
public getResponse(): ApiPlatform\Symfony\Bundle\Test\Response
<a href="/docs/main/references/Symfony/Bundle/Test/Response">ApiPlatform\Symfony\Bundle\Test\Response</a>
Gets the underlying test client.
public getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowser
Symfony\Bundle\FrameworkBundle\KernelBrowser
Returns the container.
public getContainer(): Symfony\Component\DependencyInjection\ContainerInterface
Symfony\Component\DependencyInjection\ContainerInterface
Returns the CookieJar instance.
public getCookieJar(): Symfony\Component\BrowserKit\CookieJar
Symfony\Component\BrowserKit\CookieJar
Returns the kernel.
public getKernel(): Symfony\Component\HttpKernel\KernelInterface
Symfony\Component\HttpKernel\KernelInterface
Gets the profile associated with the current Response.
public getProfile(): Symfony\Component\HttpKernel\Profiler\Profile|false
Symfony\Component\HttpKernel\Profiler\Profile
false
Enables the profiler for the very next request.If the profiler is not enabled, the call to this method does nothing.
public enableProfiler(): null
null
Disables kernel reboot between requests.By default, the Client reboots the Kernel for each request. This method allows to keep the same kernel across requests.
public disableReboot(): null
null
Enables kernel reboot between requests.
public enableReboot(): null
null
public loginUser(Symfony\Component\Security\Core\User\UserInterface $user, string $firewallContext): ApiPlatform\Symfony\Bundle\Test\Client
user | Symfony\Component\Security\Core\User\UserInterface | |
firewallContext | string |
<a href="/docs/main/references/Symfony/Bundle/Test/Client">ApiPlatform\Symfony\Bundle\Test\Client</a>
public withOptions(array $options): static
options | array |
static
Made with love by
Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.
Learn more