Download the PHP package warmans/http-testcase without Composer

On this page you can find all versions of the php package warmans/http-testcase. 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 http-testcase

HTTP Test Case

PHPUnit test case to assist in behaviour/integration testing HTTP clients libraries. The testcase can start a http server and enqueue a set of responses (a session) which can are replayed for HTTP requests to the server. This is roughly similar to the testcase provided by Guzzle but without any external (NPM) dependencies.

The HTTP server is written in golang. The source is available here: https://github.com/warmans/http-playback

Test Case API

The testcase exposes the following methods:

startServer($port)

Start a server on the given port and return a Server instance.

getServer($port)

Get a Server instance for a server previously started using startServer().

stopServers()

Tell all running servers to exit. Note that shutdown functions are automatically registered for Server instances so omitting a tearDown call to stopServers should not leave servers running.

Server API

Interactions with http playback servers are simplified using the Server instance which is returned from calls to startServer() and getServer()

start()

Start the server (generally only called by HttpTestCase::startServer()).

stop()

Stop the server (generally only called by HttpTestCase::startServer()).

enqueue($session, $status = 200, $body = "", $headers = array(), $wait = 0)

Add a response to a HTTP session. A session is just a named list of responses held within the server. Using named sessions allows the tester to simulate different endpoints without requiring exact paths. If you don't care about segregated response queues for different pages just always use the same session name.

getReplayUri($session, $path)

If you've enqueued some responses and just want the full playback URI you can use this method. e.g.

getOutput()

Get the logfile output from the server as a string. Note that a server log is created in sys_get_temp_dir().'/http-testcase.log'

isRunning()

Check if the server is currently running.

Examples

A test case will look like this (this one can be run from the project if dev dependencies are installed root using ./vendor/bin/phpunit example)


All versions of http-testcase with dependencies

PHP Build Version
Package Version
No informations.
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 warmans/http-testcase contains the following files

Loading the files please wait ...