Overview

Namespaces

  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
    • Tests
      • Batch
      • Cache
      • Common
        • Cache
        • Exception
      • Http
        • Curl
        • Exception
        • Message
          • Header
      • Inflection
      • Iterator
      • Log
      • Message
      • Mock
      • Parser
        • Cookie
        • Message
      • Parsers
        • UriTemplate
      • Plugin
        • Async
        • Backoff
        • Cache
        • Cookie
          • CookieJar
        • CurlAuth
        • ErrorResponse
        • History
        • Log
        • Md5
        • Mock
        • Oauth
        • Redirect
      • Service
        • Builder
        • Command
          • LocationVisitor
            • Request
            • Response
        • Description
        • Exception
        • Mock
          • Command
            • Sub
          • Model
        • Resource
      • Stream
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • VivaPayments
      • Message
  • PHP

Classes

  • AbstractEntityBodyDecoratorTest
  • CachingEntityBodyTest
  • ClientTest
  • CommaAggregatorTest
  • DuplicateAggregatorTest
  • EntityBodyTest
  • IoEmittingEntityBodyTest
  • MimetypesTest
  • PhpAggregatorTest
  • QueryStringTest
  • ReadLimitEntityBodyTest
  • Server
  • UrlTest
  • Overview
  • Namespace
  • Class
  • Tree

Class Server

The Server class is used to control a scripted webserver using node.js that will respond to HTTP requests with queued responses.

Queued responses will be served to requests using a FIFO order. All requests received by the server are stored on the node.js server and can be retrieved by calling Server::getReceivedRequests().

Mock responses that don't require data to be transmitted over HTTP a great for testing. Mock response, however, cannot test the actual sending of an HTTP request using cURL. This test server allows the simulation of any number of HTTP request response transactions to test the actual sending of requests over the wire without having to leave an internal network.

Namespace: Guzzle\Tests\Http
Located at tests/Guzzle/Tests/Http/Server.php
Methods summary
public
# __construct( integer $port = null )

Create a new scripted server

Create a new scripted server

Parameters

$port
Port to listen on (defaults to 8124)
public
# flush( )

Flush the received requests from the server

Flush the received requests from the server

Throws

RuntimeException
public
# enqueue( array|Guzzle\Http\Message\Response $responses )

Queue an array of responses or a single response on the server.

Queue an array of responses or a single response on the server.

Any currently queued responses will be overwritten. Subsequent requests on the server will return queued responses in FIFO order.

Parameters

$responses
A single or array of Responses to queue

Throws

Guzzle\Http\Exception\BadResponseException
public boolean
# isRunning( )

Check if the server is running

Check if the server is running

Returns

boolean
public string
# getUrl( )

Get the URL to the server

Get the URL to the server

Returns

string
public integer
# getPort( )

Get the port that the server is listening on

Get the port that the server is listening on

Returns

integer
public array
# getReceivedRequests( boolean $hydrate = false )

Get all of the received requests

Get all of the received requests

Parameters

$hydrate

Set to TRUE to turn the messages into actual Guzzle\Http\Message\RequestInterface objects. If $hydrate is FALSE, requests will be returned as strings.

Returns

array

Throws

RuntimeException
public
# start( )

Start running the node.js server in the background

Start running the node.js server in the background

public
# stop( )

Stop running the node.js server

Stop running the node.js server

Constants summary
integer DEFAULT_PORT
# 8124
string REQUEST_DELIMITER
# "\n----[request]\n"
Omnipay Viva Payments Gateway Module API Documentation API documentation generated by ApiGen