rcrowe\Hippy\Transport\Guzzle::setHttp PHP Method

setHttp() public method

Set the instance of Guzzle used to send the message.
public setHttp ( Guzzle\Http\ClientInterface $http ) : void
$http Guzzle\Http\ClientInterface
return void
    public function setHttp(HttpInterface $http)
    {
        $this->http = $http;
    }

Usage Example

Beispiel #1
0
 public function testPost()
 {
     $guzzle = new Guzzle('123', 'cog', 'vivalacrowe');
     $message = new Message(true, 'green');
     $entity = m::mock('Guzzle\\Http\\Message\\EntityEnclosingRequest');
     $entity->shouldReceive('send')->once();
     // Build up the data we are sending to Hipchat
     $data = array('room_id' => $guzzle->getRoom(), 'from' => $guzzle->getFrom(), 'message' => $message->getMessage(), 'message_format' => $message->getMessageFormat(), 'notify' => $message->getNotification(), 'color' => $message->getBackgroundColor(), 'format' => 'json');
     $http = m::mock('Guzzle\\Http\\Client');
     $http->shouldReceive('post')->with('rooms/message?format=json&auth_token=123', array('Content-type' => 'application/x-www-form-urlencoded'), http_build_query($data))->andReturn($entity)->once();
     $guzzle->setHttp($http);
     $guzzle->send($message);
 }
All Usage Examples Of rcrowe\Hippy\Transport\Guzzle::setHttp