PHP Класс Flugg\Responder\Tests\Unit\ErrorResponseBuilderTest

Автор: Alexander Tømmerås ([email protected])
Наследование: extends Flugg\Responder\Tests\TestCase
Показать файл Открыть проект

Открытые методы

Метод Описание
respondMethodShouldAllowSettingHeaders ( ) Test that you can set any headers to the JSON response by passing a second argument to the [respond] method.
respondMethodShouldAllowSettingStatusCode ( ) Test that the [respond] method allows passing a status code as the first parameter.
respondMethodShouldReturnAJsonResponse ( ) Test that the [respond] method converts the error response into an instance of [\Illuminate\Http\JsonResponse] with a default status code of 500.
setErrorMethodShouldAddErrorData ( ) Test that error data is added when an error code is set using the [setError] method.
setErrorMethodShouldAllowAddingParametersToMessage ( ) Test that the [setError] method should allow passing any parameters to the translator when resolving the error message.
setErrorMethodShouldAllowOverridingErrorMessage ( ) Test that the [setError] method allows passing a string as second argument instead of an array of parameters, which will override the error message and set it explicitly.
setErrorMethodShouldResolveErrorMessageFromTranslator ( ) Test that the [setError] method attempts to resolve an error message from the translator.
setStatusMethodShouldFailIfStatusCodeIsInvalid ( ) Test that the [setStatus] method throws an [\InvalidArgumentException] when the status code given is not a valid error HTTP status code.
setStatusMethodShouldReturnItself ( ) Test that the [setStatus] method returns the response builder, allowing for fluent method chaining.
setStatusMethodShouldSetStatusCode ( ) Test that the [setStatus] method sets the HTTP status code on the response, providing an alternative, more explicit way of setting the status code.
toArrayMethodShouldSerializeData ( ) Test that the [toArray] method serializes the data given, using the default serializer and no data.
toCollectionMethodShouldReturnACollection ( ) Test that the [toCollection] serializes the data into a collection.
toJsonMethodShouldReturnJson ( ) Test that the [toJson] serializes the data into a JSON string.
youCanResolveASuccessResponseBuilderFromTheContainer ( ) Test that you can resolve an instance of [\Flugg\Responder\ErrorResponseBuilder] from the service container.

Описание методов

respondMethodShouldAllowSettingHeaders() публичный Метод

Test that you can set any headers to the JSON response by passing a second argument to the [respond] method.

respondMethodShouldAllowSettingStatusCode() публичный Метод

Test that the [respond] method allows passing a status code as the first parameter.

respondMethodShouldReturnAJsonResponse() публичный Метод

Test that the [respond] method converts the error response into an instance of [\Illuminate\Http\JsonResponse] with a default status code of 500.

setErrorMethodShouldAddErrorData() публичный Метод

Test that error data is added when an error code is set using the [setError] method.

setErrorMethodShouldAllowAddingParametersToMessage() публичный Метод

Test that the [setError] method should allow passing any parameters to the translator when resolving the error message.

setErrorMethodShouldAllowOverridingErrorMessage() публичный Метод

Test that the [setError] method allows passing a string as second argument instead of an array of parameters, which will override the error message and set it explicitly.

setErrorMethodShouldResolveErrorMessageFromTranslator() публичный Метод

Test that the [setError] method attempts to resolve an error message from the translator.

setStatusMethodShouldFailIfStatusCodeIsInvalid() публичный Метод

Test that the [setStatus] method throws an [\InvalidArgumentException] when the status code given is not a valid error HTTP status code.

setStatusMethodShouldReturnItself() публичный Метод

Test that the [setStatus] method returns the response builder, allowing for fluent method chaining.

setStatusMethodShouldSetStatusCode() публичный Метод

Test that the [setStatus] method sets the HTTP status code on the response, providing an alternative, more explicit way of setting the status code.

toArrayMethodShouldSerializeData() публичный Метод

Test that the [toArray] method serializes the data given, using the default serializer and no data.

toCollectionMethodShouldReturnACollection() публичный Метод

Test that the [toCollection] serializes the data into a collection.

toJsonMethodShouldReturnJson() публичный Метод

Test that the [toJson] serializes the data into a JSON string.

youCanResolveASuccessResponseBuilderFromTheContainer() публичный Метод

Test that you can resolve an instance of [\Flugg\Responder\ErrorResponseBuilder] from the service container.