Guides
Tutorials
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
}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)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): nullpublic 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\ResponseInterfacepublic 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\ResponseStreamInterfacepublic 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\Responsepublic getResponse(): ApiPlatform\Symfony\Bundle\Test\ResponseApiPlatform\Symfony\Bundle\Test\Response
Gets the underlying test client.
public getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowserpublic getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowserSymfony\Bundle\FrameworkBundle\KernelBrowser
Returns the container.
public getContainer(): Symfony\Component\DependencyInjection\ContainerInterfacepublic getContainer(): Symfony\Component\DependencyInjection\ContainerInterfaceSymfony\Component\DependencyInjection\ContainerInterface
Returns the CookieJar instance.
public getCookieJar(): Symfony\Component\BrowserKit\CookieJarpublic getCookieJar(): Symfony\Component\BrowserKit\CookieJarSymfony\Component\BrowserKit\CookieJar
Returns the kernel.
public getKernel(): Symfony\Component\HttpKernel\KernelInterfacepublic getKernel(): Symfony\Component\HttpKernel\KernelInterfaceSymfony\Component\HttpKernel\KernelInterface
Gets the profile associated with the current Response.
public getProfile(): Symfony\Component\HttpKernel\Profiler\Profile|falsepublic getProfile(): Symfony\Component\HttpKernel\Profiler\Profile|falseSymfony\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(): nullpublic enableProfiler(): nullnull
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(): nullpublic disableReboot(): nullnull
Enables kernel reboot between requests.
public enableReboot(): nullpublic enableReboot(): nullnull
public loginUser(Symfony\Component\Security\Core\User\UserInterface $user, string $firewallContext): ApiPlatform\Symfony\Bundle\Test\Clientpublic loginUser(Symfony\Component\Security\Core\User\UserInterface $user, string $firewallContext): ApiPlatform\Symfony\Bundle\Test\Client| user | Symfony\Component\Security\Core\User\UserInterface | |
| firewallContext | string |
ApiPlatform\Symfony\Bundle\Test\Client
public withOptions(array $options): staticpublic withOptions(array $options): static| options | array |
static