GuzzleHttp\Handler\MockHandler::append PHP Method

append() public method

Adds one or more variadic requests, exceptions, callables, or promises to the queue.
public append ( )
    public function append()
    {
        foreach (func_get_args() as $value) {
            if ($value instanceof ResponseInterface || $value instanceof \Exception || $value instanceof PromiseInterface || is_callable($value)) {
                $this->queue[] = $value;
            } else {
                throw new \InvalidArgumentException('Expected a response or ' . 'exception. Found ' . \GuzzleHttp\describe_type($value));
            }
        }
    }

Usage Example

Example #1
0
 public function testGetLastRequest()
 {
     $request = new HttpClients\Message\Request('');
     $this->mockHandler->append(new Response('200'));
     $this->client->send($request);
     $this->assertSame($request, $this->client->getLastRequest());
 }
All Usage Examples Of GuzzleHttp\Handler\MockHandler::append