Download the PHP package michaelhall/webunit without Composer

On this page you can find all versions of the php package michaelhall/webunit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package webunit

Webunit

Tests StyleCI License Latest Stable Version Total Downloads

Webunit is a command line client for automated web application tests.

Requirements

Install with Composer

Basic usage

The client requires a file in text format, containing the tests to run. Pass the name of this file as a command line parameter:

The tests in the test file consists of one or more test cases. Every test case starts with a command. The most basic test case is just a command, e.g.

This test will be successful if the Url is functional and does not return an error or redirect status code. Otherwise, the test will fail.

The Url can also be fetched with one of the other supported HTTP methods:

A test case can also contain specific assertions:

Comments and whitespaces can be used to format the test file:

Some assertions can be modified with modifier characters:

The request can be modified with request modifiers:

The test file can set variables to be reused for the tests.

Variables are evaluated at parse-time in a manner similar to the preprocessor directives in languages like C and C#.

It is also possible to set variables from the command line:

A default value can be used to set the variable if not already set.

Example 1:

Example 2:

The following escape sequences can be used in the test file:

Escape sequence Character
\n Line feed
\r Carriage return
\s Space
\t Horizontal tab
\\ Backslash

Commands

delete url

Fetches a Url via a request.

get url

Fetches a Url via a request.

patch url

Fetches a Url via a request.

post url

Fetches a Url via a request.

put url

Fetches a Url via a request.

Assertions

assert-contains content

Asserts that the content of the result contains the specified content. Allowed modifiers are , ,

assert-empty

Asserts that the content of the result is empty. Allowed modifier is

assert-equals content

Asserts that the content of the result is the same as the specified content. Allowed modifiers are , ,

assert-header header-name[: header-value]

Asserts that the result contains a header with the specified name and an optional value. Allowed modifiers are , ,

Note: The header name is always case-insensitive.

assert-status-code status-code

Asserts that the status code of the result is the same as the specified status code. Allowed modifier is

Note: This assert must be present for a test to pass if the result has a status code other than 200-299.

Request modifiers

with-header header-name: header-value

Sets an HTTP-header with the specified name to the specified value.

with-post-file parameter-name = file-path

Sets a POST-parameter with the specified name to a file to be uploaded. The file path can be either absolute or relative to the webunit test script. This request modifier can not be used for GET requests and can not be combined with the with-raw-content request modifier.

with-post-parameter parameter-name = parameter-value

Sets a POST-parameter with the specified name to the specified value. This request modifier can not be used for GET requests and can not be combined with the with-raw-content request modifier.

with-raw-content content

Sets the request body content to the specified content. This request modifier can not be used for GET requests and can not be combined with the with-post-file and with-post-parameter request modifiers.

License

MIT


All versions of webunit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-mbstring Version *
michaelhall/http-client Version ^2.0
datatypes/datatypes Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package michaelhall/webunit contains the following files

Loading the files please wait ....