731 lines
15 KiB
YAML
731 lines
15 KiB
YAML
name: MakesHttpRequests
|
|
class_comment: null
|
|
dependencies:
|
|
- name: HttpKernel
|
|
type: class
|
|
source: Illuminate\Contracts\Http\Kernel
|
|
- name: CookieValuePrefix
|
|
type: class
|
|
source: Illuminate\Cookie\CookieValuePrefix
|
|
- name: Request
|
|
type: class
|
|
source: Illuminate\Http\Request
|
|
- name: LoggedExceptionCollection
|
|
type: class
|
|
source: Illuminate\Testing\LoggedExceptionCollection
|
|
- name: TestResponse
|
|
type: class
|
|
source: Illuminate\Testing\TestResponse
|
|
- name: SymfonyUploadedFile
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\File\UploadedFile
|
|
- name: SymfonyRequest
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Request
|
|
properties:
|
|
- name: defaultHeaders
|
|
visibility: protected
|
|
comment: '# * Additional headers for the request.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: defaultCookies
|
|
visibility: protected
|
|
comment: '# * Additional cookies for the request.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: unencryptedCookies
|
|
visibility: protected
|
|
comment: '# * Additional cookies will not be encrypted for the request.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: serverVariables
|
|
visibility: protected
|
|
comment: '# * Additional server variables for the request.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: followRedirects
|
|
visibility: protected
|
|
comment: '# * Indicates whether redirects should be followed.
|
|
|
|
# *
|
|
|
|
# * @var bool'
|
|
- name: encryptCookies
|
|
visibility: protected
|
|
comment: '# * Indicates whether cookies should be encrypted.
|
|
|
|
# *
|
|
|
|
# * @var bool'
|
|
- name: withCredentials
|
|
visibility: protected
|
|
comment: '# * Indicated whether JSON requests should be performed "with credentials"
|
|
(cookies).
|
|
|
|
# *
|
|
|
|
# * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
|
|
|
|
# *
|
|
|
|
# * @var bool'
|
|
methods:
|
|
- name: withHeaders
|
|
visibility: public
|
|
parameters:
|
|
- name: headers
|
|
comment: "# * Additional headers for the request.\n# *\n# * @var array\n# */\n#\
|
|
\ protected $defaultHeaders = [];\n# \n# /**\n# * Additional cookies for the request.\n\
|
|
# *\n# * @var array\n# */\n# protected $defaultCookies = [];\n# \n# /**\n# * Additional\
|
|
\ cookies will not be encrypted for the request.\n# *\n# * @var array\n# */\n\
|
|
# protected $unencryptedCookies = [];\n# \n# /**\n# * Additional server variables\
|
|
\ for the request.\n# *\n# * @var array\n# */\n# protected $serverVariables =\
|
|
\ [];\n# \n# /**\n# * Indicates whether redirects should be followed.\n# *\n#\
|
|
\ * @var bool\n# */\n# protected $followRedirects = false;\n# \n# /**\n# * Indicates\
|
|
\ whether cookies should be encrypted.\n# *\n# * @var bool\n# */\n# protected\
|
|
\ $encryptCookies = true;\n# \n# /**\n# * Indicated whether JSON requests should\
|
|
\ be performed \"with credentials\" (cookies).\n# *\n# * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials\n\
|
|
# *\n# * @var bool\n# */\n# protected $withCredentials = false;\n# \n# /**\n#\
|
|
\ * Define additional headers to be sent with the request.\n# *\n# * @param array\
|
|
\ $headers\n# * @return $this"
|
|
- name: withHeader
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
- name: value
|
|
comment: '# * Add a header to be sent with the request.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @param string $value
|
|
|
|
# * @return $this'
|
|
- name: withToken
|
|
visibility: public
|
|
parameters:
|
|
- name: token
|
|
- name: type
|
|
default: '''Bearer'''
|
|
comment: '# * Add an authorization token for the request.
|
|
|
|
# *
|
|
|
|
# * @param string $token
|
|
|
|
# * @param string $type
|
|
|
|
# * @return $this'
|
|
- name: withBasicAuth
|
|
visibility: public
|
|
parameters:
|
|
- name: username
|
|
- name: password
|
|
comment: '# * Add a basic authentication header to the request with the given credentials.
|
|
|
|
# *
|
|
|
|
# * @param string $username
|
|
|
|
# * @param string $password
|
|
|
|
# * @return $this'
|
|
- name: withoutToken
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Remove the authorization token from the request.
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: flushHeaders
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Flush all the configured headers.
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: withServerVariables
|
|
visibility: public
|
|
parameters:
|
|
- name: server
|
|
comment: '# * Define a set of server variables to be sent with the requests.
|
|
|
|
# *
|
|
|
|
# * @param array $server
|
|
|
|
# * @return $this'
|
|
- name: withoutMiddleware
|
|
visibility: public
|
|
parameters:
|
|
- name: middleware
|
|
default: 'null'
|
|
comment: '# * Disable middleware for the test.
|
|
|
|
# *
|
|
|
|
# * @param string|array|null $middleware
|
|
|
|
# * @return $this'
|
|
- name: handle
|
|
visibility: public
|
|
parameters:
|
|
- name: request
|
|
- name: next
|
|
comment: null
|
|
- name: withMiddleware
|
|
visibility: public
|
|
parameters:
|
|
- name: middleware
|
|
default: 'null'
|
|
comment: '# * Enable the given middleware for the test.
|
|
|
|
# *
|
|
|
|
# * @param string|array|null $middleware
|
|
|
|
# * @return $this'
|
|
- name: withCookies
|
|
visibility: public
|
|
parameters:
|
|
- name: cookies
|
|
comment: '# * Define additional cookies to be sent with the request.
|
|
|
|
# *
|
|
|
|
# * @param array $cookies
|
|
|
|
# * @return $this'
|
|
- name: withCookie
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
- name: value
|
|
comment: '# * Add a cookie to be sent with the request.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @param string $value
|
|
|
|
# * @return $this'
|
|
- name: withUnencryptedCookies
|
|
visibility: public
|
|
parameters:
|
|
- name: cookies
|
|
comment: '# * Define additional cookies will not be encrypted before sending with
|
|
the request.
|
|
|
|
# *
|
|
|
|
# * @param array $cookies
|
|
|
|
# * @return $this'
|
|
- name: withUnencryptedCookie
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
- name: value
|
|
comment: '# * Add a cookie will not be encrypted before sending with the request.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @param string $value
|
|
|
|
# * @return $this'
|
|
- name: followingRedirects
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Automatically follow any redirects returned from the response.
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: withCredentials
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Include cookies and authorization headers for JSON requests.
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: disableCookieEncryption
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Disable automatic encryption of cookie values.
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: from
|
|
visibility: public
|
|
parameters:
|
|
- name: url
|
|
comment: '# * Set the referer header and previous URL session value from a given
|
|
URL in order to simulate a previous request.
|
|
|
|
# *
|
|
|
|
# * @param string $url
|
|
|
|
# * @return $this'
|
|
- name: fromRoute
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
- name: parameters
|
|
default: '[]'
|
|
comment: '# * Set the referer header and previous URL session value from a given
|
|
route in order to simulate a previous request.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @param mixed $parameters
|
|
|
|
# * @return $this'
|
|
- name: withPrecognition
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Set the Precognition header to "true".
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: get
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a GET request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: getJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with a GET request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: post
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a POST request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: postJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with a POST request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: put
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a PUT request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: putJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with a PUT request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: patch
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a PATCH request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: patchJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with a PATCH request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: delete
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a DELETE request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: deleteJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with a DELETE request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: options
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with an OPTIONS request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: optionsJson
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Visit the given URI with an OPTIONS request, expecting a JSON response.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: head
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: headers
|
|
default: '[]'
|
|
comment: '# * Visit the given URI with a HEAD request.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: json
|
|
visibility: public
|
|
parameters:
|
|
- name: method
|
|
- name: uri
|
|
- name: data
|
|
default: '[]'
|
|
- name: headers
|
|
default: '[]'
|
|
- name: options
|
|
default: '0'
|
|
comment: '# * Call the given URI with a JSON request.
|
|
|
|
# *
|
|
|
|
# * @param string $method
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $data
|
|
|
|
# * @param array $headers
|
|
|
|
# * @param int $options
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: call
|
|
visibility: public
|
|
parameters:
|
|
- name: method
|
|
- name: uri
|
|
- name: parameters
|
|
default: '[]'
|
|
- name: cookies
|
|
default: '[]'
|
|
- name: files
|
|
default: '[]'
|
|
- name: server
|
|
default: '[]'
|
|
- name: content
|
|
default: 'null'
|
|
comment: '# * Call the given URI and return the Response.
|
|
|
|
# *
|
|
|
|
# * @param string $method
|
|
|
|
# * @param string $uri
|
|
|
|
# * @param array $parameters
|
|
|
|
# * @param array $cookies
|
|
|
|
# * @param array $files
|
|
|
|
# * @param array $server
|
|
|
|
# * @param string|null $content
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
- name: prepareUrlForRequest
|
|
visibility: protected
|
|
parameters:
|
|
- name: uri
|
|
comment: '# * Turn the given URI into a fully qualified URL.
|
|
|
|
# *
|
|
|
|
# * @param string $uri
|
|
|
|
# * @return string'
|
|
- name: transformHeadersToServerVars
|
|
visibility: protected
|
|
parameters:
|
|
- name: headers
|
|
comment: '# * Transform headers array to array of $_SERVER vars with HTTP_* format.
|
|
|
|
# *
|
|
|
|
# * @param array $headers
|
|
|
|
# * @return array'
|
|
- name: formatServerHeaderKey
|
|
visibility: protected
|
|
parameters:
|
|
- name: name
|
|
comment: '# * Format the header name for the server array.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @return string'
|
|
- name: extractFilesFromDataArray
|
|
visibility: protected
|
|
parameters:
|
|
- name: '&$data'
|
|
comment: '# * Extract the file uploads from the given data array.
|
|
|
|
# *
|
|
|
|
# * @param array $data
|
|
|
|
# * @return array'
|
|
- name: prepareCookiesForRequest
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * If enabled, encrypt cookie values for request.
|
|
|
|
# *
|
|
|
|
# * @return array'
|
|
- name: prepareCookiesForJsonRequest
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * If enabled, add cookies for JSON requests.
|
|
|
|
# *
|
|
|
|
# * @return array'
|
|
- name: followRedirects
|
|
visibility: protected
|
|
parameters:
|
|
- name: response
|
|
comment: '# * Follow a redirect chain until a non-redirect is received.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Http\Response|\Illuminate\Testing\TestResponse $response
|
|
|
|
# * @return \Illuminate\Http\Response|\Illuminate\Testing\TestResponse'
|
|
- name: createTestRequest
|
|
visibility: protected
|
|
parameters:
|
|
- name: symfonyRequest
|
|
comment: '# * Create the request instance used for testing from the given Symfony
|
|
request.
|
|
|
|
# *
|
|
|
|
# * @param \Symfony\Component\HttpFoundation\Request $symfonyRequest
|
|
|
|
# * @return \Illuminate\Http\Request'
|
|
- name: createTestResponse
|
|
visibility: protected
|
|
parameters:
|
|
- name: response
|
|
- name: request
|
|
comment: '# * Create the test response instance from the given response.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Http\Response $response
|
|
|
|
# * @param \Illuminate\Http\Request $request
|
|
|
|
# * @return \Illuminate\Testing\TestResponse'
|
|
traits:
|
|
- Illuminate\Cookie\CookieValuePrefix
|
|
- Illuminate\Http\Request
|
|
- Illuminate\Testing\LoggedExceptionCollection
|
|
- Illuminate\Testing\TestResponse
|
|
interfaces: []
|