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): null
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
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
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
public getResponse(): ApiPlatform\Symfony\Bundle\Test\Response
ApiPlatform\Symfony\Bundle\Test\Response
Gets the underlying test client.
public getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowser
public getKernelBrowser(): Symfony\Bundle\FrameworkBundle\KernelBrowser
Symfony\Bundle\FrameworkBundle\KernelBrowser
Returns the container.
public getContainer(): Symfony\Component\DependencyInjection\ContainerInterface
public getContainer(): Symfony\Component\DependencyInjection\ContainerInterface
Symfony\Component\DependencyInjection\ContainerInterface
Returns the CookieJar instance.
public getCookieJar(): Symfony\Component\BrowserKit\CookieJar
public getCookieJar(): Symfony\Component\BrowserKit\CookieJar
Symfony\Component\BrowserKit\CookieJar
Returns the kernel.
public getKernel(): Symfony\Component\HttpKernel\KernelInterface
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
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
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
public disableReboot(): null
null
Enables kernel reboot between requests.
public enableReboot(): null
public enableReboot(): null
null
public loginUser(Symfony\Component\Security\Core\User\UserInterface $user, string $firewallContext): ApiPlatform\Symfony\Bundle\Test\Client
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 |
ApiPlatform\Symfony\Bundle\Test\Client
public withOptions(array $options): static
public withOptions(array $options): static
options | array |
static