Download the PHP package oscarotero/psr7-unitesting without Composer
On this page you can find all versions of the php package oscarotero/psr7-unitesting. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oscarotero/psr7-unitesting
More information about oscarotero/psr7-unitesting
Files in oscarotero/psr7-unitesting
Package psr7-unitesting
Short Description Library to tests psr-7 compatible classes
License MIT
Homepage https://github.com/oscarotero/psr7-unitesting
Informations about the package psr7-unitesting
psr7-unitesting
Simple library to execute unit tests in psr-7 compatible http messages.
It uses symfony/dom-crawler and symfony/css-selector library to parse and test the html in the body. And Guzzle as http client
This package provides a binary java file with the w3c vnu validator (to validate html) but you can use the REST api (slower) if you don't have (or don't want to have) java installed.
Usage example:
Available assertions:
Message
method | description |
---|---|
hasHeader |
Asserts that a header exists |
hasNotHeader |
Asserts that a header does not exists |
header |
Asserts that a header has a specific value |
protocolVersion |
Asserts the protocol version of the message |
body |
Asserts the body content (as string) |
assertBody |
Returns a Stream assertion instance |
Request
Extends Message
with the following additions:
method | description |
---|---|
method |
Asserts the method value |
requestTarget |
Asserts the request target value |
uri |
Asserts the uri value (as string) |
assertUri |
Returns a Uri assertion instance |
ServerRequest
Extends Request
with the following additions:
method | description |
---|---|
hasServerParam |
Asserts that a server param exists |
serverParam |
Asserts a server param value |
hasCookieParam |
Asserts that a cookie param exists |
cookieParam |
Asserts a cookie param value |
hasQueryParam |
Asserts that a query param exists |
queryParam |
Asserts a query param value |
hasUploadedFile |
Asserts that an uploaded file exists |
hasParsedBody |
Asserts that a param exists in the parsed body |
parsedBody |
Asserts a value in the parsed body |
hasAttribute |
Asserts that an attribute exists |
attribute |
Asserts an attribute value |
Response
Extends Message
with the following additions:
method | description |
---|---|
statusCode |
Asserts the status code value |
reasonPhrase |
Asserts the reason pharase value |
assertHtml |
Returns a Html assertion instance |
Uri
method | description |
---|---|
scheme |
Asserts the scheme value |
authority |
Asserts the authority value |
userInfo |
Asserts the user info value |
host |
Asserts the host value |
port |
Asserts the port value |
path |
Asserts the path value |
query |
Asserts the query value |
fragment |
Asserts the fragment value |
Stream
method | description |
---|---|
size |
Asserts the stream size |
isSeekable |
Asserts that the stream is seekable |
isNotSeekable |
Asserts that the stream is not seekable |
isWritable |
Asserts that the stream is writable |
isNotWritable |
Asserts that the stream is not writable |
isReadable |
Asserts that the stream is readable |
isNotReadable |
Asserts that the stream is not readable |
assertHtml |
Returns a Html assertion instance |
Html
method | description |
---|---|
count |
Asserts the number of elements matching with the selector |
has |
Asserts there is at least one element matching with the selector |
hasNot |
Asserts there is not any element matching with the selector |
contains |
Asserts there is at least one element matching with the selector containing the text |
notContains |
Asserts there is not any element matching with the selector and containing the text |
isValid |
Asserts the html value is w3c standard |
map |
Execute a callback for each element selected |
All versions of psr7-unitesting with dependencies
phpunit/phpunit Version *
psr/http-message Version ^1.0
symfony/dom-crawler Version ~3.0
symfony/css-selector Version ~3.0
guzzlehttp/guzzle Version ~6.2
symfony/process Version ~3.0