1. Go to this page and download the library: Download kununu/testing-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Creates and returns a Builder that you can use to do a GET request
public static function aGetRequest(): self;
// Creates and returns a Builder that you can use to do a POST request
public static function aPostRequest(): self;
// Creates and returns a Builder that you can use to do a DELETE request
public static function aDeleteRequest(): self;
// Creates and returns a Builder that you can use to do a PUT request
public static function aPutRequest(): self;
// Creates and returns a Builder that you can use to do a PATCH request
public static function aPatchRequest(): self;
// Set The Request parameters
public function withParameters(array $parameters): self;
// Change The request method
public function withMethod(string $method): self;
// Set the URI to fetch
public function withUri(string $uri): self;
// Set the content of the request as an array that internally is transformed to a json and provided as the raw body data
public function withContent(array $content): self;
// Set the Raw body data
public function withRawContent(string $content): self;
// Sets an HTTP_AUTHORIZATION header with the value of "Bearer $token"
public function withAuthorization(string $token): self;
// Sets an header.
// In converts any header name to uppercase and prepends "HTTP_" if the header name does not contains it
public function withHeader(string $headerName, string $headerValue): self;
// Sets a server parameter (HTTP headers are referenced with an HTTP_ prefix as PHP does)
public function withServerParameter(string $parameterName, string $parameterValue): self;
final protected function doRequest(RequestBuilder $builder): Symfony\Component\HttpFoundation\Response